Skip to main content
Every webhook request is signed with HMAC-SHA256 using your endpoint secret. Validate the signature before trusting the payload.
Webhook endpoints are publicly reachable URLs. Anyone who knows the URL can send a POST to it. Always validate the signature before processing. Don’t take an unsigned or invalid-signature request seriously.

Headers

Node.js example

Tips

  • Use a constant-time comparison for the signature check (e.g. crypto.timingSafeEqual in Node) to avoid timing attacks.
  • Stringify the body identically to how it was received - middleware that reformats JSON will break the signature. Either store the raw body before parsing or use a body parser that preserves the exact byte sequence.
  • Reject stale events by checking X-Timestamp is within (e.g.) 5 minutes of now. Combined with signature validation, this protects against replay attacks.
  • Don’t log the secret. It should only ever appear in your secret manager and in memory inside the validation routine.