Webhook Signature Verification
Every Amps webhook carries a Svix signature header. Verify it before processing the payload to confirm the request originated from Amps and has not been tampered with.Signature Header
Every webhook carries three Svix headers, and signature verification uses all three:svix-signature is a space-separated list of v1,<base64> signatures (a second entry appears briefly after a secret rotation, so a valid request matches any one of them). svix-timestamp is the Unix second the message was signed, used for replay protection. The scheme is the standard Svix HMAC SHA-256.
Verifying Signatures
Using Svix SDK (Recommended)
The easiest way to verify webhooks is using the Svix SDK:Manual Verification
If your language has no Svix SDK, replicate the scheme by hand. The signed content is{svix-id}.{svix-timestamp}.{rawBody}, the HMAC key is the base64 body of your whsec_... secret, and the result is a base64-encoded HMAC SHA-256 digest:
Getting Your Webhook Secret
Your webhook secret is available in the Amps AI Dashboard:- Navigate to Webhooks settings
- Select your webhook endpoint
- Copy the webhook secret
- Store it securely (environment variable, secret manager)
Security Best Practices
Always Verify Signatures
Always Verify Signatures
Every webhook request must be verified before processing. Reject any request without a valid signature.
Check Timestamps
Check Timestamps
Verify that webhook timestamps are recent (within 5 minutes) to prevent replay attacks.
Use HTTPS
Use HTTPS
Always use HTTPS endpoints for webhooks. Never accept webhooks over HTTP in production.
Store Secrets Securely
Store Secrets Securely
Use environment variables or secret management services. Never hardcode secrets.
Implement Idempotency
Implement Idempotency
Use the
svix-id header to prevent processing duplicate webhooks. Store processed delivery IDs.Rate Limiting
Rate Limiting
Implement rate limiting on your webhook endpoint to prevent abuse.
Example Implementation
Node.js/Express
Python/Flask
Testing Webhook Verification
Local Testing
Use tools like ngrok to expose your local endpoint:Signature Testing
Test your verification logic with known good signatures before going to production.Troubleshooting
Signature verification always fails
Signature verification always fails
Check that:
- You’re using the correct webhook secret
- The payload hasn’t been modified (use raw body parser)
- The signature header is being read correctly
- Timestamps are within the acceptable window
Getting duplicate webhooks
Getting duplicate webhooks
Implement idempotency checking using the
svix-id header. Store processed delivery IDs and skip duplicates.Webhooks timing out
Webhooks timing out
Ensure your endpoint responds within 30 seconds. Process webhooks asynchronously if needed.
Next Steps
Webhook Types
See all webhook event types
Webhook Overview
Learn about webhook setup