Skip to main content
Elastly records an event when something your systems may need to act on happens, such as a price change, a quote outcome or a finished sync. You can receive every event as a signed POST to your own endpoint, read the same events from the event feed, or both. This page covers setting up the endpoint, the event types and payload, signature verification, delivery and retries, and the event feed.

Who can set up webhooks

Turning webhooks on, setting the endpoint, rotating the secret and sending a test event need Edit access to the API & webhooks area. See Roles.

Set up an endpoint

1

Open the webhooks card

Go to Manage > API & webhooks. The Webhooks card is at the bottom of the page.
2

Turn webhooks on

Switch on Webhooks.
3

Enter the endpoint

Enter the Endpoint URL and press Enter. The address must be a public https:// address on port 443 with a host name. Private and internal addresses and IP addresses are refused.
4

Copy the signing secret

Reveal the Signing secret and copy it to your endpoint’s configuration. It starts with whsec_.
5

Send a test event

Select Send test event. Elastly posts a sample price.changed event and shows the result on the card. Test events are never retried or replayed.
The endpoint receives every event type. To stop deliveries for a while, switch off Webhooks and confirm with Pause.

Event types

Payload

Every event has the same shape. data.object names the record the event is about; some events add sku, connection_id, kind or state.
The payload names what changed. Read the current state through the API or the dashboard.

Verify the signature

Every delivery carries these headers. The TypeScript client verifies a delivery for you with verifyWebhook. See Client libraries. To verify a delivery yourself:
  1. Join the webhook-id, the webhook-timestamp and the raw request body with a period: id.timestamp.body.
  2. Remove the whsec_ prefix from the signing secret and decode the rest from base64.
  3. Compute an HMAC-SHA256 of the joined string with the decoded secret and encode it in base64.
  4. Accept the delivery if any v1 signature in the header matches, using a constant-time comparison.
Use the raw body exactly as received. Parsing and re-encoding the JSON changes it and breaks the signature. Reject a delivery whose timestamp is far from your current time, for example more than five minutes, to block replayed requests.
The scheme follows the Standard Webhooks specification, so a Standard Webhooks library can verify deliveries too.

Rotate the signing secret

Select Rotate next to Signing secret, then Rotate secret. The previous secret keeps signing for 24 hours, so each delivery in that window carries two signatures. Update your endpoint within 24 hours.

Delivery and retries

  • Respond with any 2xx status to acknowledge a delivery. Respond quickly and do the work afterwards; an attempt that takes longer than 15 seconds counts as failed.
  • Delivery is at least once and in no guaranteed order. Use webhook-id to ignore an event you already handled.
  • A failed attempt is retried up to 9 more times, from 5 seconds to 24 hours apart. For 429, 502 and 503 responses, a Retry-After header of up to 24 hours is honoured.
  • A 410 response stops deliveries to the endpoint at once.
  • After 5 days of failed deliveries, deliveries stop. Fix the endpoint and switch Webhooks on again.
When deliveries stop after a 410 or 5 days of failures, events that occur meanwhile are not posted. Read them from the event feed to catch up.

Delivery log

Select Delivery log on the Webhooks card to see every attempt with its Event, Status, Attempt, Response and Sent time. Select Replay on a delivery to post the same event again with its original id. Replay is available for 15 days after sending.

Read the event feed

GET /v1/events returns the same events, oldest first, in the payload shape above. Any Live, Test or Read-only key can read it; a live key reads live events and a test key reads test events. Filter with type and follow it with the after cursor. See Pagination.
Store the nextCursor of each page and send it as after on your next request to read only newer events.