Webhooks
In this guide, we will look at how to register and consume webhooks to integrate your app with Emailit. With webhooks, your app can know when something happens in Emailit, such as someone sending an email or adding a contact.
Registering webhooks
To register a new webhook, you need to have a URL in your app that Emailit can call. You can configure a new webhook from the Emailit dashboard under Webhooks. Give your webhook a name, pick the events you want to listen for, and add your URL.
Now, whenever something of interest happens in your app, a webhook is fired off by Emailit. In the next section, we'll look at how to consume webhooks.
Consuming webhooks
When your app receives a webhook request from Emailit, check the type
attribute to see what event caused it. The first part of the event type will tell you the payload type, e.g., a email, delivery, etc.
Example webhook payload
{
"event_id": "a056V7R7NmNRjl70",
"type": "email.delivery.sent",
"object": {
"id": "WAz8eIbvDR60rouK"
// ...
}
}