How Webhooks Work
When an event occurs, Lettr sends an HTTP POST request to your configured endpoint with a JSON payload describing the event. Your server processes the event and responds with a success status code.Lettr Sends Webhook
An authenticated POST request is sent to your endpoint with the event payload (using your configured auth method).
You Verify & Process
Your server verifies authentication, processes the event, and responds with a 2xx status.
Use Cases
Webhooks enable powerful real-time integrations:| Event Type | Use Case |
|---|---|
message.delivery | Update your database when emails are successfully delivered |
message.bounce | Remove invalid addresses from your mailing list |
engagament.open | Track engagement metrics and trigger follow-up sequences |
engagament.click | Measure link performance and user interest |
message.spam_complaint | Immediately suppress users who mark emails as spam |
relay.relay_delivery | Process inbound emails, create support tickets, track replies |
Managing Webhooks
Webhooks are created and managed through the Lettr dashboard. The API provides read-only access to list and view your configured webhooks.Creating a Webhook
Enter Your Endpoint URL
Provide the HTTPS URL where Lettr should send event notifications. This must be a publicly accessible endpoint.
Select Events
Choose which events to receive. You can subscribe to all events or select specific event types from the five categories (Message, Engagement, Generation, Unsubscribe, Relay).
Configure Authentication
Optionally set up authentication for webhook deliveries. Lettr supports:
- None — No authentication (not recommended for production)
- Basic Auth — HTTP Basic Authentication with a username and password
- OAuth2 — OAuth 2.0 client credentials with client ID, client secret, and token URL
Editing a Webhook
To update a webhook’s URL, events, or authentication:- Go to Webhooks
- Click on the webhook you want to edit
- Make your changes
- Click Save
Enabling and Disabling Webhooks
You can temporarily disable a webhook without deleting it. This is useful during maintenance or when debugging your endpoint:- Go to Webhooks
- Find the webhook you want to toggle
- Click Enable or Disable
Deleting a Webhook
To permanently remove a webhook:- Go to Webhooks
- Find the webhook you want to delete
- Click Delete and confirm
You can create up to 5 webhooks per account. Webhook management (create, update, enable/disable, delete) is only available through the dashboard. The API provides read-only access for listing and viewing webhook configurations.
Handling Webhooks
Here’s a basic example of a webhook handler in Node.js with Express:Event Categories
Lettr webhooks are organized into five categories:Message Events
Events tracking the delivery lifecycle of emails you send:message.injection- Email accepted by Lettr and queued for deliverymessage.delivery- Email delivered to recipient’s mail servermessage.bounce- Email bounced (hard or soft)message.delay- Email delivery temporarily delayedmessage.out_of_band- Out-of-band bounce after initial acceptancemessage.spam_complaint- Recipient marked email as spammessage.policy_rejection- Email rejected by policy
Engagement Events
Events tracking recipient interaction with your emails:engagament.open- Recipient opened the emailengagament.initial_open- First open of the emailengagament.click- Recipient clicked a linkengagament.amp_open- Recipient opened an AMP emailengagament.amp_initial_open- First open of an AMP emailengagament.amp_click- Recipient clicked a link in an AMP email
Generation Events
Events for message generation failures:generation.generation_failure- Message failed during generationgeneration.generation_rejection- Message rejected during generation
Unsubscribe Events
Events for recipient opt-outs:unsubscribe.list_unsubscribe- Recipient unsubscribed via List-Unsubscribe headerunsubscribe.link_unsubscribe- Recipient unsubscribed via a link in the email
Relay Events
Events for inbound email processing:relay.relay_injection- Inbound email received and queuedrelay.relay_delivery- Inbound email delivered to your endpointrelay.relay_rejection- Inbound email rejectedrelay.relay_tempfail- Inbound email delivery temporarily failedrelay.relay_permfail- Inbound email delivery permanently failed
Subscribing to Events
When creating a webhook in the dashboard, you choose which events to receive. You can subscribe to all events or select specific event types from the five categories listed above.Viewing Webhooks via API
The API provides read-only access to your webhooks. You can list all webhooks and view details for a specific webhook:To create, update, enable/disable, or delete webhooks, use the Lettr dashboard. The API is read-only for webhook management.
Best Practices
Respond Quickly
Respond Quickly
Return a 200 response as soon as possible. If processing takes time, acknowledge receipt immediately and process asynchronously. Lettr waits up to 30 seconds for a response before marking the delivery as failed.
Verify Authentication
Verify Authentication
Always verify the webhook authentication before processing. Configure Basic Auth or OAuth 2.0 on your webhook and validate credentials in your handler to ensure the request came from Lettr.
Handle Duplicates
Handle Duplicates
Implement idempotency in your handler. Due to retries, you may receive the same event multiple times. Use the event
id to detect and skip duplicates.Use HTTPS
Use HTTPS
Always use HTTPS endpoints. Lettr will not send webhooks to insecure HTTP URLs in production.
Monitor Failures
Monitor Failures
Set up alerting for webhook failures. The dashboard shows delivery status and recent failures for each webhook.