How Paubox delivers webhook notifications
How Paubox delivers webhook notifications
This article explains what Paubox expects from your webhook endpoint, what happens if it doesn't respond, and how to check that a notification really came from Paubox. Share it with whoever builds or looks after the system that receives your webhooks.
What your endpoint needs to do
- Accept POST requests at an https:// address with a valid security certificate.
- Reply with a success code (any 2xx code, such as 200) within 30 seconds.
- Reply first, and do any slow processing afterwards. If your endpoint takes longer than 30 seconds, Paubox counts that attempt as failed.
If your endpoint doesn't respond: email delivery events
This applies to email.delivered, email.opened, email.temporary_failure and email.failed.
- If your endpoint returns an error, takes longer than 30 seconds or can't be reached, Paubox tries again up to three more times within a few minutes.
- If every attempt fails, Paubox doesn't send that notification again. Your developer can still look up any message's delivery status with the Paubox Email API.
- Paubox never removes or turns off your webhook because your endpoint returned errors.
If your endpoint doesn't respond: inbound email
This applies to email.received.
- If your endpoint returns a 429 or 5xx code, takes longer than 30 seconds or can't be reached, Paubox tries again after 30 seconds, after 2 minutes and after 5 minutes. That's four attempts in total.
- Other error codes, such as 400 or 404, mean your endpoint refused the notification, so Paubox doesn't try again.
- If your endpoint returns 410 (Gone), Paubox turns the webhook off. It shows as Disabled on the Webhooks tab.
- Received messages stay on the Inbound page and are available through the API, so your developer can catch up on anything that was missed.
Duplicate notifications
You might sometimes get the same notification more than once, for example after a retry, or if you have more than one webhook for the same event. Build your endpoint so that handling the same notification twice does no harm.
- For email delivery events, use the tracking ID, the recipient and the event name together to spot a repeat.
- For inbound email, use the email ID.
Checking that a notification came from Paubox
- Inbound email notifications are signed. When you create a webhook for email.received, Paubox shows a signing secret once. Your developer uses it to check the signature on each notification. Instructions are at https://docs.paubox.com/email-api/webhooks.
- Email delivery notifications aren't signed at the moment, and no signing secret is shown when you create one of these webhooks. To protect your endpoint, use a web address that's hard to guess, and have your system confirm important details, such as a message's status, with the Paubox Email API before acting on them.