The payload
type is the event; the Event catalog lists all of them. field, from
and to appear only on a status_changed event. The three payload pages under Webhooks
in the API reference tab describe every field.
The payload carries ids rather than the whole record. To get the record as it is now,
call https://app.vensight.ai followed by links.self, with your API key. A record copied
into the payload would already be out of date by the time a retry delivered it.
Verifying the signature
Every request carriesVensight-Signature: t=<unix seconds>,v1=<hex>. The v1 value is an
HMAC-SHA256 of "<t>.<raw body>", using your endpoint’s signing secret.
timingSafeEqual, compare_digest), not ==, so it does not leak the answer through its
timing.
Other headers: Vensight-Event (the type), Vensight-Event-Id (stable across retries; key
your idempotency on this) and Vensight-Delivery (this delivery to this endpoint; it stays
the same on every retry of it, so it is useful for matching your logs to ours).
What counts as delivered
Any 2xx within 10 seconds. If your endpoint has not answered by then, the attempt counts as failed and is retried. So answer first and do the work afterwards: queue the event and return 200. A handler that finishes its processing before answering will eventually time out, and you will process the same event twice. A 3xx is treated as a failure, not a success. A redirect on a webhook endpoint is almost always a misconfiguration, and following it would send your data, and its signature, to a URL nobody registered.Retries
A failed delivery is retried on a backing-off schedule: 30 seconds, then 1 minute, 2, 4, 8, 16, 32, 64, 128 and 256 minutes, then every 6 hours, up to 14 attempts, a little over a day in total (about 26½ hours). Each wait has a small random offset, so deliveries that failed together do not all come back at once. The one exception is 410 Gone: if your endpoint answers with it, that delivery is not retried. Every other failure, including a4xx, is retried as above, because an endpoint
part-way through its own deploy often answers that way for a minute.
An endpoint is paused automatically when 20 deliveries in a row have each failed every
retry (or been answered 410), on the assumption that it has been taken down rather than
having a bad moment. In practice that means it has been unreachable for more than a day. Any
successful delivery resets the count. You will see it paused, with the reason, in Vensight.
A paused endpoint loses nothing. Events that happen while it is paused are held, and when
you resume it they are sent, oldest first, within a few minutes. The same is true if you
pause an endpoint yourself.
Duplicates and order
Each event is delivered at least once. Normally that means exactly once, but a delivery whose answer was lost on the way back (a timeout, a dropped connection) is sent again. Key your processing onVensight-Event-Id and skip one you have already handled.
Events are not guaranteed to arrive in order. A retried event can land after a newer
one. The number in Vensight-Event-Id only ever goes up, so if order matters to you, compare
it before applying a change, or fetch the current record from links.self, which is always
up to date.
Catching up after missed deliveries
After 14 attempts a single delivery stops for good. That event is not lost either: every event is also an entry on the change feed, and you can read it back from there. The webhook and the feed name the same things differently:
To catch up:
- Take the
created_atof the last event you processed successfully. - Read
/v1/changes?updated_since=<that created_at>, page by page, untilhas_moreisfalse. Addevent_name=to read only the events you subscribe to. - Skip any entry whose id you have already processed.
updated_sinceincludes the boundary, so the last event you handled comes back once. - Process the rest exactly as you would a webhook.
walk is the paging function from the Quickstart.
Rotating the signing secret
There is no button to replace an endpoint’s secret. Rotate it by running two endpoints for a short while:- In Settings → Developers, add a second endpoint with the same URL and the same events. It gets its own new secret.
- Change your handler to accept a signature made with either secret.
- Deliveries now arrive twice, once per endpoint, with the same
Vensight-Event-Id. If you already key your idempotency on it, as above, the second copy is skipped. - Delete the old endpoint, then remove the old secret from your handler.
Choosing events
Leave the event list empty to receive everything. Otherwise name the types you want, such asvendors.status_changed or documents.created. The
Event catalog lists every one.
Exactly one event is sent per change, with the most specific name that applies, so a
status change does not also arrive as an updated.