Verify and handle webhooks
wamo signs every webhook request according to the Standard Webhooks specification. Always verify the signature before trusting a request.
Request headers
Each request includes these headers:
Verify with a library
The simplest approach is an official Standard Webhooks library. Pass the raw request body, the headers, and your endpoint’s signing secret.
Verify against the raw request body exactly as received. Parsing the JSON and serializing it again can change the bytes and make verification fail.
Verify manually
If you can’t use a library:
Build the signed content
Concatenate the webhook-id header, the webhook-timestamp header, and the raw body, separated by periods: {webhook-id}.{webhook-timestamp}.{body}.
Compute the expected signature
Remove the whsec_ prefix from your secret and base64-decode the rest. Compute an HMAC-SHA256 of the signed content with that key, then base64-encode the result.
Respond quickly
wamo treats any 2xx response as a successful delivery. Any other status code, a timeout, or a connection error counts as a failure. Return a 2xx response as soon as you’ve verified and stored the event, and do slower processing asynchronously.
Retries and duplicates
Failed deliveries are retried automatically with exponential backoff. Delivery is at least once, so your endpoint can receive the same event more than once.
- Use the
webhook-idheader as an idempotency key and skip events you’ve already processed. A retry of the same event has the samewebhook-id. - Don’t rely on events arriving in order. For a transaction,
COMPLETEDandFAILEDare final statuses: if aPENDINGevent arrives after one of them, ignore it.