Verifying signatures
Validate Standard Webhooks signatures on HTTP endpoints.
HTTP webhooks are signed with your endpoint’s whsec_… secret using the Standard Webhooks scheme.
Headers
| Header | Purpose |
|---|---|
Webhook-Id | Unique delivery id |
Webhook-Timestamp | Unix timestamp (seconds) |
Webhook-Signature | One or more v1,<base64> signatures |
Verification steps
- Read the raw request body bytes (do not re-serialize JSON first).
- Build the signed content:
{webhook-id}.{webhook-timestamp}.{body}. - Compute HMAC-SHA256 with the secret (after decoding the
whsec_prefix per Standard Webhooks). - Compare to each
v1signature using a constant-time compare. - Reject if the timestamp is too old (Standard Webhooks libraries typically allow a few minutes of skew).
Prefer an official Standard Webhooks SDK for your language rather than hand-rolling crypto.
Security checklist
- Serve HTTPS only.
- Keep the signing secret server-side.
- Rotate by creating a new webhook, cutting traffic over, then deleting the old one.
- Treat Discord/Teams endpoints as unauthenticated message sinks; they do not use
whsec_signatures.