Why Use Svix Webhooks?
Svix webhooks offer several advantages over direct webhooks:- Built-in Security: Automatic request signing with cryptographic verification
- Reliable Delivery: Advanced retry logic with exponential backoff
- Delivery Dashboard: Web UI to monitor webhook deliveries and debug failures
- Multiple Endpoints: Support for multiple webhook endpoints via channels
- Event Filtering: Route different event types to different endpoints
- Replay Capability: Manually replay failed webhook deliveries
How Svix Webhooks Work
When you submit an async job with Svix webhooks configured, Reducto will:- Process your document asynchronously
- Send a signed webhook notification to Svix when the job completes (or fails)
- Svix delivers the notification to your configured endpoint(s) with automatic retries
- Your application verifies the signature and processes the webhook payload
Setting Up Svix Webhooks
Step 1: Configure Your Webhook Endpoint
First, get the Svix configuration URL to set up your webhook endpoints:- Add webhook endpoint URLs
- Configure channels for routing
- View delivery logs and debug failures
- Get your webhook signing secret
Step 2: Submit Jobs with Svix Webhooks
Using Channels for Routing
Channels allow you to route webhooks to different endpoints. For example, you might want to send production jobs to one endpoint and development jobs to another:Webhook Handler with Signature Verification
View webhook handler code (Python / TypeScript)
View webhook handler code (Python / TypeScript)
Using Svix Webhooks with Extract
Svix webhooks work with all async endpoints. Here’s an example with the extract endpoint:Webhook Payload Structure
The webhook notification will be sent as a JSON POST request with the following structure:Verifying Webhook Signatures
Svix automatically signs all webhook requests. Always verify the signature to ensure the webhook is legitimate and hasn’t been tampered with.Why Signature Verification Matters
Without signature verification, anyone could send fake webhook requests to your endpoint. Signature verification ensures:- The webhook came from Reducto/Svix (authenticity)
- The payload hasn’t been modified (integrity)
- The webhook isn’t a replay of an old request (freshness)
Getting Your Webhook Secret
- Go to the Svix dashboard (use the URL from
/configure_webhook) - Navigate to your endpoint settings
- Copy the webhook signing secret (starts with
whsec_) - Store it securely as an environment variable
Signature Verification Best Practices
- Always verify signatures: Never skip signature verification in production
- Use the official Svix SDK: The SDK handles signature verification correctly
- Preserve raw request body: Don’t parse the JSON before verification
- Check timestamp: Reject webhooks with timestamps too far in the past
- Store secrets securely: Use environment variables or secret management systems
Managing Webhooks in the Svix Dashboard
The Svix dashboard provides powerful tools for managing your webhooks:Viewing Delivery Logs
- See all webhook deliveries with timestamps and status codes
- View request and response bodies for debugging
- Filter by endpoint, status, or time range
Debugging Failed Deliveries
- Identify why webhooks failed (network errors, timeouts, invalid responses)
- View detailed error messages and stack traces
- Check signature verification failures
Manual Replay
- Replay failed webhooks after fixing issues
- Replay webhooks to test new endpoint implementations
- Bulk replay multiple webhooks at once
Endpoint Management
- Add, edit, or remove webhook endpoints
- Configure rate limits and retry policies
- Set up endpoint-specific channels and filters
Advanced Features
Multiple Endpoints
Configure multiple webhook endpoints to receive the same events:Channel-Based Routing
Use channels to route different types of jobs to different endpoints:Best Practices
- Always Verify Signatures: Use the Svix SDK to verify webhook signatures. Never skip this step in production.
- Use HTTPS: Always use HTTPS endpoints to ensure secure transmission of webhook data.
-
Implement Idempotency: Your webhook handler should be idempotent since Svix may retry deliveries. Use the
svix-idheader as an idempotency key. - Return Quickly: Return a 2xx status code quickly (within 15 seconds). Process the job result asynchronously if needed.
- Use Channels for Environments: Separate production and development webhooks using channels to avoid mixing test and production data.
- Monitor the Dashboard: Regularly check the Svix dashboard for failed deliveries and debug issues promptly.
- Handle Failures Gracefully: Implement proper error handling and logging in your webhook endpoint.
- Use Metadata: Include custom metadata in your webhook configuration to help identify and route jobs in your application.
- Test with Replay: Use the Svix dashboard’s replay feature to test your webhook handler without submitting new jobs.
- Set Up Alerts: Configure alerts in your monitoring system for webhook delivery failures.
Troubleshooting
Webhooks Not Being Received
- Check the Svix dashboard for delivery attempts and errors
- Verify your endpoint URL is correct and publicly accessible
- Ensure your endpoint returns a 2xx status code
- Check for firewall or network issues blocking Svix’s IP addresses
Signature Verification Failing
- Verify you’re using the correct webhook secret from the Svix dashboard
- Ensure you’re passing the raw request body to the verification function
- Check that all required headers (
svix-id,svix-timestamp,svix-signature) are present - Make sure you’re using the latest version of the Svix SDK
Webhook Timeouts
- Reduce processing time in your webhook handler
- Return a 2xx response immediately and process asynchronously
- Check for slow database queries or external API calls
- Consider using a message queue for heavy processing
Comparison with Direct Webhooks
| Feature | Svix Webhooks | Direct Webhooks |
|---|---|---|
| Setup complexity | Requires Svix configuration | Simple URL configuration |
| Security | Built-in request signing | Manual validation required |
| Retry logic | Advanced with exponential backoff | Basic (3 retries) |
| Delivery tracking | Full dashboard with logs | Not included |
| Multiple endpoints | Supported via channels | One URL per job |
| Replay capability | Built-in via dashboard | Not available |
| Debugging tools | Comprehensive dashboard | Manual logging required |