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
- ✅ Process requests quickly (< 10 seconds recommended)
- ✅ Handle retries gracefully (idempotent processing)
- ✅ Log events for debugging and monitoring
- ✅ Verify signatures for security
Retry Behavior
Automatic Retries: If your endpoint doesn’t respond with a 2xx status code, Magic Hour will retry delivery:- Duration: Up to 24 hours
- Pattern: Exponential backoff (1s, 2s, 4s, 8s, …)
- After 24 hours: Event marked as failed, no more retries
Production Handler Examples
Best Practices
1. Idempotent Processing
Handle duplicate events gracefully (Magic Hour may retry):2. Quick Response Times
Respond within 10 seconds to avoid timeouts: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?- Respond within 10 seconds
- Use background tasks for long processing
- Check server resources and scaling
- Verify webhook is enabled in Developer Hub
- Check endpoint URL is correct and accessible
- Review server logs for errors
- Implement idempotent processing
- Store processed event IDs
- Handle retries gracefully