Prompt
How do I add event webhooks for email delivery status?
Latest observation
Oct 6, 2026
OpenAI APIWeb search: off
To add event webhooks for email delivery status, the general steps are:
-
Create a webhook endpoint on your server
- Set up an HTTPS endpoint that can accept
POSTrequests. - Make sure it returns a fast
2xxresponse. - Example:
https://yourdomain.com/webhooks/email-status
- Set up an HTTPS endpoint that can accept
-
Register the webhook in your email provider
- In your email service dashboard or API, add the URL of your endpoint.
- Select the events you want, such as:
deliveredopenedclickedbounceddroppedspam_reported
-
Verify webhook authenticity
- Most providers sign webhook payloads with a secret.
- Validate the signature on each request to ensure it came from the provider.
-
Parse and handle the event payload
- The webhook body usually includes:
- event type
- message ID
- recipient
- timestamp
- reason/failure details, if any
- Update your database or trigger workflows accordingly.
- The webhook body usually includes:
-
Test with a sample event
- Send a test notification from your provider’s dashboard or API.
- Confirm your endpoint receives and correctly processes it.
Example webhook handler
app.post('/webhooks/email-status', express.json(), (req, res) => {
const event = req.body;
switch (event.event) {
case 'delivered':
// mark message as delivered
break;
case 'bounced':
// mark message as failed
break;
}
res.sendStatus(200);
});
If you tell me which email service you’re using (SendGrid, Mailgun, Postmark, AWS SES, etc.), I can give you the exact setup steps and payload format.