How to establish webhook handshake for an app in production?

The webhooks-guide focuses on getting webhooks working in development, but there’s little information that I can find on how to set up the webhook handshake after deploying the app in production (e.g., a Flask app running on GCP Cloud Run).

Do I have to use Postman to setup the handshake for my app running on a cloud service in production, as described in the docs for developing/testing webhooks?

How can a developer automate this process for CI/CD? Could I use a curl -X POST command in my CI/CD workflow in order to establish the webhooks handshake?

It would be great to have some docs/examples on deploying a custom webhooks app to AWS or GCP.

@Phil_Seeman maybe you can help?

Hi @Nick_Youngblut,

Overall, the process for doing it in production is the same as shown in the docs; that is, you set up a small app that receives an HTTP request and responds accordingly. It’s just that in production, instead of that app residing on your local machine, you publish it to your preferred cloud platform (and of course do not need ngrok or Postman). In our case with Flowsana, we have a small web app running in our Azure instance.

In terms of CI/CD, yes, I think it would work to kick off the new webhook via something like a curl command. You’d still set the target to be the little web app running in your cloud instance to handle the handshake.

Does this all make sense? Please ask more if not.

Thanks @Phil_Seeman! That helps out a lot.

1 Like

@Phil_Seeman in regards to using curl to create new webhooks in a CI/CD pipeline, I can’t get curl to work, although Postman is working. My curl command:

curl -X POST \
  -H "Authorization: Bearer ${ASANA_PAT}" \
  -d "resource=${ASANA_RESOURCE}" \
  -d "target=https://${SUBDOMAIN}.ngrok-free.app/receiveWebhook" \
  https://app.asana.com/api/1.0/webhooks

The error:

{"errors":[{"message":"You do not have access to this resource.","help":"For more information on API status codes and how to handle them, read the docs on errors: https://developers.asana.com/docs/errors"}]}

Do you have any idea on what the problem is? For the curl command, I’m following the docs at Establish a webhook

I would check the values of ASANA_PAT and 'ASANA_RESOURCE` as that error indicates that the supplied PAT doesn’t have permission to access that resource. Maybe the pipeline isn’t properly setting those values?

It was a mis-specification of the ASANA_RESOURCE. Thanks for the help!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.