Skip to main content
Every webhook delivery includes an X-Bodha-Signature header containing an HMAC-SHA256 hex digest of the raw request body, signed with your endpoint’s secret. Always verify the signature before processing a webhook — it proves the payload was sent by Bodha and hasn’t been tampered with.

How it works

  1. When you create a webhook endpoint, Bodha generates a secret starting with whsec_.
  2. For each delivery, Bodha computes HMAC-SHA256(secret, rawBody) and sends the hex digest in X-Bodha-Signature.
  3. Your server recomputes the same HMAC and compares it using a timing-safe comparison.

Verification examples

Important notes

Use the raw request body — not the parsed and re-serialized JSON. Parsing and re-serializing can change key order or whitespace, which will produce a different HMAC.
  • Timing-safe comparison — Always use crypto.timingSafeEqual (Node), hmac.compare_digest (Python), or Rack::Utils.secure_compare (Ruby) to prevent timing attacks.
  • Rolling secrets — You can roll (rotate) an endpoint’s secret from the Developer Portal or via the API. After rolling, only the new secret signs future deliveries.