Skip to main content
You can receive Prava webhooks in any backend language or framework. Verify every request on your server with the endpoint signing secret (whsec_...) before you process the event.
Your application API secret (sk_test_... or sk_live_...) is a different credential. Never use it to verify webhook signatures.

Request headers

How the signature is computed

The v1 digest is HMAC-SHA256 over timestamp + "." + raw_body, keyed with the complete whsec_... secret as UTF-8. During a 24-hour rotation overlap the header can contain several v1 values; a match against either active secret is enough.

Verify a request

  1. Read the raw request bytes. Verify before JSON parsing, reserialization or any application processing; rebuilding JSON changes the bytes.
  2. Reject a missing or malformed Prava-Signature, or one with duplicate timestamps.
  3. Reject timestamps more than five minutes in the past or future. Keep your receiver’s clock synchronized.
  4. Compute the expected digest with each active secret and compare it to every v1 value in constant time.
  5. Only then parse the body, and check that the environment and account are the ones you expect.

Example in JavaScript

Pass the exact request bytes from your HTTP framework as rawBody.

Handle the verified request

  • Put a unique database constraint on the event ID.
  • Process slow business logic asynchronously, after you respond.
  • A receiver timeout is an unknown outcome, so Prava may send the same event again.

Rotate your signing secret

Administrators can rotate an endpoint’s secret.
  1. Rotate, then save the new secret when it’s shown. You can’t retrieve it later, and an idempotent retry returns the completion status without showing it again.
  2. Prava signs with both the old and new secrets for 24 hours. Deploy verification with the new secret during that overlap.
  3. Retire the old secret.
You can’t rotate again until the overlap ends.

Next steps

  • For a runnable starting point, use the Node.js or Python receiver examples. Their runtime and storage requirements apply only to those examples; you can implement the same verification and delivery handling in your existing application.
  • See Test your integration to verify your destination, send test events, and check retries and secret rotation.