Skip to main content
Your endpoint’s URL is public, so anyone who finds it can post to it. Spott signs every delivery with the endpoint’s secret, and your receiver checks that signature before it acts on the delivery. This works the same whether the endpoint was set up in Settings or through the API.

What a delivery contains

Each delivery is a POST with a JSON body. The body’s event.name says which event it is, and each event’s page in the sidebar shows its payload. Three headers carry what you need to check it:

Find the secret

For an endpoint created through the API, the secret is the secret that creating the endpoint returned, or that your last rotation returned. The API cannot return it again. Settings → Webhooks also shows the secret of each endpoint to an admin.

Check the signature

The open-source svix library checks all three headers for you, in most languages, and also turns away old messages that someone replays:
To check a delivery without the library:
  1. Take the part of the secret after whsec_ and decode it from base64. That is the key.
  2. Join svix-id, svix-timestamp and the raw body with dots: <svix-id>.<svix-timestamp>.<body>.
  3. Compute the HMAC-SHA256 of that text with the key, and encode the result in base64.
  4. Accept the delivery if the result equals any one of the v1 signatures in svix-signature, compared in constant time.
  5. Turn it away if svix-timestamp is more than a few minutes from your current time.
The header can carry several signatures because, for a while after a rotation, Spott signs with both the old and the new secret. Accepting any one match is what keeps your receiver working through a rotation, whichever of the two secrets it has.

Answer the delivery

Answer with a 2xx status as soon as the signature checks out, and do the real work afterwards, for example from a queue. Any other status, or no answer, counts as a failed delivery, and Spott tries again later. A retry has the same svix-id, so check it before you act twice on the same message.

Troubleshooting