POST from Botdog includes an X-Webhook-Signature header. Verifying it lets your endpoint reject forged requests and replays.
Header format
The secret is shown once when the webhook is created in the dashboard. Store it securely — typically in an env var or secret manager. You can rotate it from the same screen.
Verification algorithm
- Read the
X-Webhook-Signatureheader and split on,to gett=…ands=…. - Read the raw request body as a string. Do not re-serialize it — even reordering keys will change the bytes and break the signature.
- Compute
HMAC-SHA256(secret, "{t}.{rawBody}")and hex-encode the result. - Compare the computed value with
susing a constant-time comparison (e.g.crypto.timingSafeEqual). - Optionally reject requests where
tis older than a few minutes to defeat replay attacks.