Webhook
Last updated
Last updated
Fires a webhook every time a task is passed as input. Returns the same task as output.
URL. The url where to send the webhook. Secret. The secret to pass along with the webhook.
In case the webhook cannot be sent (e.g. Ango Hub does not receive a 200 response), Ango Hub will keep the task in the Webhook stage and display a visual warning in the Workflow editor:
To view the tasks the webhooks of which were not sent, navigate to the Tasks tab and filter by stage from the left-hand side.
To attempt to send the webhook again, click on the Webhook stage, then click on the three dots on the top right of its settings panel, and click on Re-run.
This sample is a minimum server setup you can use to test whether your webhook configuration is working or not.
Run this Python script, changing your_secret_key
with a secret key of your choice.
Install ngrok on your system. Instructions on installing ngrok can be found here.
Once ngrok is installed, from the command line/terminal, run ngrok http 127.0.0.1:5000
You will see a screen like the following. Copy the URL highlighted in red.
Go to your Ango Hub project and set up your workflow to have a Webhook stage plugged in. In this case, for example, the Webhook stage will fire every time a labeler submits a task in the Label stage:
Click on the Webhook plugin to open its settings.
In the URL field, paste the URL we copied before, adding /hook
at the end. For example, if the URL provided by ngrok was https://47f2-88-243-68-208.ngrok.io
, you will paste it and add /hook
at the end, forming https://47f2-88-243-68-208.ngrok.io/hook
.
In the Secret field, type the secret key you entered in the Python script during step 1.
Save your workflow.
In your project, perform an action which would trigger a webhook. In our example above, it would be submitting a tasl from the Label stage.
If the webhook worked correctly, you will see a 200 OK
code in the ngrok window:
And the webhook content will be sent to your server where you ran the Python script. If you ran it in PyCharm, for example, you will see the webhook contents in the Run tab:
Export | Webhook |
---|---|
Batches provided as names.
Batches provided as IDs.
stageHistory
field present.
stageHistory
field not present.