Integrating Webhooks with Ango Hub
Ango Hub can fire webhooks with a JSON of the label contents to a URL of your choice when, in a project of your choice, said label gets created or updated.
From your organization's Organization page, enter the Webhooks tab.
Click on the Add Webhook button. A dialog will appear.
- URL: The URL Ango Hub will send a webhook to.
- Project: The project to monitor for changes.
- Trigger: When to send the webhook. Label Completed triggers only when an annotator clicks on Submit, while Label Updated triggers when an annotator clicks on Save.
- Secret Key: The secret key you will integrate and check in your endpoint.
Click on OK to save and enable your webhook.
Now, whenever a label is completed, updated, or both (depending on your choice of trigger,) Ango Hub will send a POST request to the URL you provided with the contents of the created/updated label.
Here is a sample server set up to receive webhooks from Ango Hub.
from flask import request, Flask
secret = b'your_secret_key' # Secret Key you entered while adding the integration
app = Flask(__name__)
@app.route('/hook', methods=['POST']) # Custom Endpoint
computed_signature = hmac.new(secret, msg=request.data, digestmod=hashlib.sha1).hexdigest()
if request.headers["X-Hub-Signature"] != computed_signature:
print("Error") # Signature Mismatch means the webhook was triggered by a 3rd party.
print(json.dumps(request.get_json(), indent=2)) # This is the actual label result
if __name__ == '__main__':
As webhooks cannot be sent to a local address, you will need to expose your local address to a public endpoint.