Get notified about events with webhooks
A webhook sends a signed JSON event to your HTTPS endpoint whenever a resource it covers is created, changed or removed. Use it to drive automations without polling.
Create a webhook
- Go to Integrations → Webhooks → Create webhook
- Enter a Name.
- Enter the URL of your HTTPS endpoint.
- Under Resource types, check the resources the webhook covers, for example Servers.
- Click Create webhook.
The webhook's page then shows its Signing secret. Copy it to verify each delivery.
To check your endpoint, click ⋯ next to the webhook and then Send test event. You get one test event for each resource type, with event set to test and data set to null.
What you receive
Each delivery is a POST request with a JSON body that describes one event on one resource:
Every resource type sends created, updated and destroyed:
Some resource types send more events:
Verify the signature
Every delivery carries an X-Signature header with sha256= followed by the HMAC-SHA256 of the raw request body, keyed on the webhook's signing secret. Compute it on the raw body before you parse it, use the secret as it's shown, and compare in constant time:
To rotate the secret, remove the webhook and create a new one.
Delivery and retries
- Respond with a 2xx status within 10 seconds. Do slow work after you respond.
- Failed deliveries are retried up to 10 attempts in total, spread across about a day.
- Deduplicate on the
X-Deliveryheader. It stays the same for every retry of an event. - Order events by
occurred_at. A retried event can arrive after newer ones.
When an event fails all 10 attempts, the webhook is paused. The Failed column shows the consecutive failed attempts. Fix your endpoint, then click ⋯ next to the webhook and Resume. Events that happen while a webhook is paused aren't sent later.
Need help?
Please let us know at hello@betterstack.com.
We're happy to help! 🙏