Webhooks


An introduction to webhooks

  • A webhook is like a reverse API endpoint
  • Instead of sending the API a "GET" request to get the status of something, a webhook allows the customer to subscribe to notifications, sent via "POST", that are triggered by predetermined events
  • Webhooks are currently available to our Paubox Email API customers
  • Paubox webhooks support endpoints which use the HTTPS protcol, on connections which use TLS 1.2 and above

Why use webhooks?

  • Webhooks are useful because they allow users to receive instant updates whenever the subscribed event is triggered
  • This can help with such things as:
    • Providing real-time status updates for custom analytics
    • Custom alerts
    • Automating workflows

How to use webhooks

  • Click the 'Webhooks' link in the left-hand navigation menu, in the API section
  • Click the 'Add new webhook' button to bring up the webhook form modal
  • Webhooks are currently triggered at an organization-wide level. This means that events for all domains your organization has set up with Paubox will trigger a webhook notification.

Webhook fields

  • URL: You will need to provide an HTTPS URL which you own, to which you would like your webhook payload to be sent.
  • Event: The events notifications to which you would like to subscribe

Available Events

Event NameEvent Name Key ValueTrigger
Message Deliveredmessage_deliveredWhen message is delivered
Message Temporary Failuremessage_temporary_failureOn soft bounce of message
Message Permanent Failuremessage_permanent_failureOn hard bounce of message

Payloads

Every Webhook notification will include an event_name key, and a payload key. The type of payload you should expect is dependent on the data model that is triggering the webhook event.

The most common type of payload is the Message payload, which is structured as follows:

{
"event_name": "message_delivered",
"payload": {
"id": 15266298,
"recipients": [
"xxxxxxx@paubox.com"
],
"bcc": [],
"subject": "Test 033",
"from": "xxxxx@xxxxxxxx.com",
"time": "2021-06-25T21:15:00.464Z"
}
}