Delivery guarantees
- Best-effort delivery: ButterCMS attempts to deliver each webhook once; failed deliveries are logged but not automatically retried
- Timeout: Webhook endpoints must respond within 5 seconds
- Status codes: Return 2xx status codes to acknowledge successful processing
What counts as successful delivery?
A webhook is considered successfully delivered when:- Connection is established to your endpoint
- Response is received within 5 seconds
- Status code is in the 2xx range (200-299)
What causes delivery failure?
A webhook delivery fails if:- Connection failed - Unable to establish TCP connection
- Timeout - No response received within 5 seconds
- 4xx/5xx response - Server returned an error status code
- Invalid SSL certificate - HTTPS certificate validation failed
Failed webhook deliveries are logged on ButterCMS’s side but are not automatically retried. Design your webhook handler to be resilient and consider implementing your own retry mechanism for critical integrations.
Timeout handling
Your webhook endpoint must respond within 5 seconds or ButterCMS will consider the delivery failed.Why timeouts happen
- Synchronous processing of long-running tasks
- Database queries taking too long
- Calling external APIs without timeout limits
- Resource contention under high load
Avoiding timeouts
Use async processing - Acknowledge the webhook immediately, then process asynchronously:Timeout-safe patterns
Proper error responses
Return appropriate status codes so ButterCMS knows how to handle failures:Return 2xx for success
Always return a 2xx status code when you’ve successfully received and queued the webhook:Return 4xx for client errors
Return 4xx for permanent client-side errors:Return 5xx for server errors
Return 5xx for server-side errors:Response code decision guide
Handling duplicate deliveries
While ButterCMS uses best-effort delivery, your endpoint may occasionally receive duplicate webhooks due to network conditions. Implementing idempotency is a best practice for any webhook handler:Why duplicates may occur
- Network issues during response transmission
- Your server processed successfully but response was lost
- Infrastructure failover scenarios
Idempotency strategies
1. Track by Unique Identifier Create a unique ID from the webhook data:Graceful degradation
Build resilient webhook handlers that degrade gracefully when dependencies fail:Circuit breaker pattern
Fallback processing
Monitoring failed deliveries
Track webhook failures to identify issues early:Logging best practices
Alerting on failures
Set up alerts for:- Webhook endpoint downtime
- High error rates (>5% failures)
- Processing latency spikes
- Circuit breaker trips