Skip to main content
Zavu signs all webhook requests with an HMAC-SHA256 signature. You should verify this signature to ensure the request is authentic and hasn’t been tampered with.

Signature Header

Every webhook request includes an X-Zavu-Signature header:
The header contains:

Verifying Signatures

Step 1: Extract the Signature

Parse the X-Zavu-Signature header to get the timestamp and signature:

Step 2: Prepare the Signed Payload

Concatenate the timestamp and the raw request body:

Step 3: Compute the Expected Signature

Use HMAC-SHA256 with your webhook secret:

Step 4: Compare Signatures

Use a constant-time comparison to prevent timing attacks:

Complete Examples

Timestamp Validation

Always validate the timestamp to prevent replay attacks:
Never skip signature verification in production. An attacker could send fake webhook events to your endpoint.

Troubleshooting

Signature Mismatch

If signature verification fails:
  1. Check your secret - Ensure you’re using the correct webhook secret from the sender’s webhook configuration
  2. Use raw body - The signature is computed on the raw request body, not parsed JSON
  3. Check encoding - Ensure the body is UTF-8 encoded
  4. Verify timestamp format - The timestamp in the signature is in seconds, not milliseconds

Testing Locally

For local development, you can temporarily disable signature verification or use a tool like ngrok to expose your local server.

Next Steps