Overview
Webhooks let you react to events in real time instead of polling the API. This guide covers setting up a subscription, building an endpoint, and handling events reliably.1. Create a webhook subscription
Register your endpoint URL and choose which events to listen for:Response
2. Build your endpoint
Your webhook endpoint must:- Accept
POSTrequests with aContent-Type: application/jsonbody - Return a
2xxstatus code within 30 seconds - Be publicly accessible (not behind a VPN or firewall)
3. Handle failures gracefully
Return 200 immediately
Acknowledge receipt quickly. If processing takes time, queue it for async handling. Anton times out after 30 seconds and will retry.
Make it idempotent
You may receive the same event more than once (retries). Use the
event.id to deduplicate — store processed event IDs and skip duplicates.4. Monitor deliveries
Check the delivery history for a webhook event:Testing locally
For local development, use a tunnel service to expose your local endpoint:Best practices
Respond fast
Return
200 within 5 seconds. Queue heavy processing for later.Deduplicate
Track event IDs to prevent processing the same event twice.
Log everything
Log the full event payload for debugging and audit.
Set up alerts
Monitor for delivery failures — if your endpoint goes down, events queue up.