Every webhook request includes an X-Arowana-Signature header. Always verify it before processing the payload to ensure the request came from Arowana and wasn’t tampered with.

How it works

1

Read the raw request body

Use the exact HTTP body bytes. Do not parse and re-serialize JSON before verifying — this changes the byte sequence and breaks the signature.
2

Compute HMAC-SHA256

Sign the raw body bytes with your webhook secret using HMAC-SHA256. The expected value is sha256= followed by the hex digest.
3

Compare with constant-time equality

Use a constant-time comparison to prevent timing attacks. Return 401 on a missing header, a different length or a mismatch — do not process the payload. (Node’s crypto.timingSafeEqual throws on buffers of different length: check the length first, as below.)

Implementation

Do not use express.json() on the webhook route. The middleware parses the body before you can verify the raw bytes.

Replays and the timestamp

The signature covers the raw body only — it contains no timestamp of its own, so it does not stop someone who captured a request from sending it to you again. Protect against that the same way you handle normal retries:
  • Deduplicate by the envelope id (evt_…). Every retry and every “Send again” from the dashboard carries the same id and the same body. Store the ids you processed and answer 2xx to a repeat without acting on it again (mark an id processed only once its work succeeded — see Retries and idempotency). In rare cases one change is announced twice with two different ids; where that matters, also deduplicate on data.message_id + event. Retries run for about 25 hours; a manual “Send again” can come later, so keep the ids for as long as you can.
  • The envelope’s timestamp is inside the signed body, so it cannot be changed without breaking the signature. It is the time of the event, not of the request: a retry a day later carries the original time. Use it to order events, not to reject old requests.
  • Accept webhooks over HTTPS only (Arowana delivers only to https URLs).

Rotating the secret

PATCH /v1/webhooks/{id} with a new secret takes effect immediately: every request from then on — new events, retries of earlier ones, and test deliveries — is signed with the new secret. There is no period in which Arowana signs with both. To rotate without rejecting anything:
  1. Generate the new secret and let your receiver accept either the old or the new one.
  2. Send the new secret with PATCH /v1/webhooks/{id}.
  3. Once requests verify with the new secret, remove the old one from your receiver.
A secret you set or that was generated is returned once, in the response of POST /v1/webhooks; the API never lists it again. In the dashboard (Settings → API & webhooks) brand managers can show and copy it at any time.