New to webhooks? Start with our Webhook Quickstart for a
complete end-to-end tutorial.
Production Requirements
Your production webhook handler should:- ✅ Handle POST requests with JSON payloads
- ✅ Return 2xx status codes for successful processing
- ✅ Acknowledge promptly after verifying and durably accepting the event
- ✅ Handle retries gracefully (deduplicate repeated deliveries)
- ✅ Log events for debugging and monitoring
- ✅ Verify signatures for security
Retry Behavior
Automatic Retries: Network failures, timeouts, and non-2xx responses cause Magic Hour to schedule another delivery attempt:- Pattern: Scheduled delays of 1, 2, 4, 8, … minutes, capped at 60 minutes
- Expiry: Events more than 24 hours old are marked as failed and are no longer delivered
- Security headers: The timestamp and signature are regenerated for each delivery attempt
Production Handler Examples
Best Practices
1. Deduplicate Webhook Deliveries
Magic Hour may retry delivery, so detect and skip repeated events:started event.
2. Quick Response Times
Acknowledge promptly after signature verification and durable acceptance. Run long processing from the saved event. The abbreviated timing examples below do not implement those production requirements:3. Comprehensive Logging
Log all events for debugging:4. Error Handling
Handle errors gracefully:Local Testing
Test your handler locally before deploying:Deployment Considerations
Load Balancing
If using multiple servers, ensure webhooks can reach any instance:Health Checks
Add a health check endpoint:Monitoring
Monitor webhook delivery and processing:Next Steps
Secure Your Handler
Add signature verification for production security
Event Types Reference
Complete list of webhook events and payloads
Webhook API Reference
Detailed webhook API documentation
Quickstart Guide
New to webhooks? Start with our quickstart
Common Issues
Webhook timeouts?- Return 2xx promptly after signature verification and durable acceptance
- Process long-running work from a durable queue or saved event, not only in-process background tasks
- Check server resources and scaling
- Verify webhook is enabled in Developer Hub
- Check endpoint URL is correct and accessible
- Review server logs for errors
- Deduplicate deliveries using the project ID and event type
- Store processed deduplication keys
- Handle retries gracefully