Skip to main content

Webhook Signatures

Every webhook request includes a signature that you should verify to ensure the request came from JetEmail and hasn’t been tampered with.

Signature Headers

Each webhook request includes these headers:

Verifying Signatures

The signature is computed using HMAC-SHA256 with your webhook secret and the raw request body.

Security Best Practices

Always Verify Signatures

Never process webhook events without verifying the signature first. This prevents attackers from sending fake events to your endpoint.

Use HTTPS

Always use HTTPS for your webhook endpoint to ensure the payload is encrypted in transit.

Use Timing-Safe Comparison

Use constant-time string comparison functions to prevent timing attacks when verifying signatures.

Handle Duplicate Events

Use the X-Webhook-ID header to detect and handle duplicate events. Store processed event IDs and skip duplicates.

Replay Prevention

To prevent replay attacks, you can verify that the timestamp is recent:
A tolerance of 5 minutes (300 seconds) is recommended to account for clock drift between servers.

Rotating Secrets

If you need to rotate your webhook secret:
  1. Generate a new secret in Dashboard → Webhooks
  2. Update your application to accept both the old and new secrets
  3. Once all events are using the new secret, remove the old one from your code