How Lettr Webhook Delivery Works
When an email event occurs, Lettr sends an HTTP POST request to your configured webhook endpoint. The delivery follows this sequence:- Event occurs (e.g., email is delivered)
- Lettr queues the webhook payload
- Lettr sends an HTTP POST to your endpoint URL
- Your server must respond with a
2xxstatus code within 30 seconds - If the request fails, Lettr retries with exponential backoff
What Counts as a Failure
Retry Logic and Schedule
When a webhook delivery fails, Lettr retries the request with exponential backoff:
After 6 failed retries (7 total attempts, spanning roughly 35 hours), the webhook event is marked as permanently failed and no further delivery attempts are made. Webhooks that keep failing are disabled automatically; re-enable them from the webhook’s page in the dashboard once the issue is fixed.
The webhook’s page in the Lettr dashboard (Webhooks, then select the webhook) shows its Last Attempt time and Last Status. Failed events can’t be replayed from the dashboard, so make your own system able to recover missed events.
Diagnosing Failures
Check the Webhook Status
Start with the webhook’s status in the Lettr dashboard:- Go to Webhooks in the dashboard
- Click on the webhook endpoint that is failing
- Check whether it is Enabled, and review its Last Attempt and Last Status
- Compare the last attempt time with your server and load balancer logs to see the request Lettr sent and the response your server returned
Common Failure Patterns
All events failing with connection timeout
All events failing with connection timeout
Your server is taking longer than 30 seconds to respond.Fixes:
- Process webhook events asynchronously. Accept the request immediately (return
200), then process the event in a background job. - Check if your server is overloaded or if the webhook handler has a performance bottleneck.
- Verify your firewall or WAF is not dropping or holding POST requests to your webhook path. Webhooks are not sent from a fixed, published set of IP addresses, so allow the path rather than specific IPs.
All events failing with DNS resolution error
All events failing with DNS resolution error
Lettr cannot resolve your webhook endpoint hostname.Fixes:
- Verify the URL in your webhook settings is correct.
- Check that your DNS records are properly configured and your domain is resolving.
- If you recently changed DNS providers, wait for propagation to complete.
All events failing with TLS error
All events failing with TLS error
The TLS handshake to your server is failing.Fixes:
- Verify your SSL certificate is valid and not expired.
- Ensure your server supports TLS 1.2 or higher.
- Check that the certificate chain is complete (intermediate certificates included).
Intermittent 5xx errors
Intermittent 5xx errors
Your server is sometimes returning 500-series errors.Fixes:
- Check your server logs around the time of the failed deliveries.
- Look for out-of-memory errors, database connection pool exhaustion, or unhandled exceptions in your webhook handler.
- Ensure your webhook handler is idempotent — it should handle receiving the same event more than once.
403 Forbidden responses
403 Forbidden responses
Your server is rejecting the request due to authentication or authorization rules.Fixes:
- If you have IP-based access controls, exempt your webhook path from them. Webhooks are not sent from a fixed, published set of IP addresses, so authenticate requests with the auth method configured on the webhook instead.
- If you require authentication headers, make sure the Basic or OAuth 2.0 credentials configured on the webhook match what your middleware expects. Lettr doesn’t send a signature header.
- Check for CSRF protection middleware intercepting the POST request.
Handling Timeouts
The 30-second timeout is the most common cause of webhook failures. Your webhook handler should return a response as quickly as possible.Recommended Architecture
Endpoint Authentication
Lettr doesn’t sign webhook payloads. Instead, each webhook has an authentication type (None, Basic, or OAuth 2.0), and Lettr sends the matchingAuthorization header with every request. Use Basic or OAuth 2.0 in production and reject requests without valid credentials.
Verifying Basic Auth
- Read the
Authorizationheader - Decode the Base64 value after
Basic - Compare the username and password with the ones configured on the webhook
Common Authentication Failures
Idempotency
Lettr may deliver the same webhook event more than once (due to retries or network issues). Handlers must be idempotent: processing the same event twice should not cause duplicate side effects. See Duplicate Emails for duplicate sends and webhook events.Implementing Idempotency
Use theevent_id included in every event to deduplicate:
Testing Webhooks
Before deploying to production, test your webhook endpoint to verify it handles events correctly.Triggering Real Events
Generate real events by sending an email:- Go to Webhooks, select your endpoint, and confirm it is enabled and subscribed to the events you handle
- Send an email with a live API key to an address you control
- Open the email and click a link to generate engagement events
- Check your server logs and the webhook’s Last Status to verify delivery
Using a Tunnel for Local Development
To test webhooks against a local development server, use a tunnel service:Related Topics
Webhook Introduction
Overview of Lettr’s webhook system and available event types.
Webhook Authorization
Set up and verify webhook authentication.
Webhook Retries
Detailed retry behavior and handling.
Authentication Issues
Troubleshoot API key and auth problems.