The Basics of Webhooks
Webhooks are user-defined HTTP callbacks that are triggered by email events such as a successful email delivery or a link clicked in your email. Whenever an event is triggered, a post request is sent to the URL, that is configured to receive the webhook data. This data can be used by multitude of different things such as triggering a “Pepipost offer to Mandrill customers an exclusive 3-month free trial to send unlimited transactional emails” event in your application or storing data. A popular use of webhooks is to obtain data in real-time, on how effectively messages are being delivered or how engaged users are with these messages.
Webhooks are also referred to as reverse-APIs as the send information to your applications on a real-time basis, without having to poll for data.
Email Events and Types of Webhooks
With each email you send, there can be multiple events that can be triggered. For example, email delivered, email bounced, email opened, email clicks are all events that can be tracked by email service providers such as Pepipost.
Email delivered, bounced or dropped (hard bounces or email failed to delivered due to continued soft bounces) are events that occur during the delivery stage and can be classified as Email Delivery Webhooks. By configuring these webhooks with your application, you can get answers to questions such as:
- Was the email successfully delivered to the Inbox or did email delivery fail?
- Did the email bounce? If so, was it a soft bounce or a hard bounce?
Other events such as opens, clicks, subscribes and complaints occur after the email has been delivered. These can be termed as Recipient Engagement Webhooks. Setting up these webhooks will help you answer questions such as:
- Did the recipient open his / her email?
- Did the recipient click within the email?
- Did the recipient unsubscribe?
Common Parameters / Data sent via Webhooks
All webhooks will have common parameters or data that is sent across for every event being triggered. These parameters include:
- Event type (open, click, delivered etc.)
- Recipient who triggered the event
- Common message header that includes Message ID, Tags, Campaign ID.
- Sending domain
- Recipient engagement details such as country in which the email was opened, device, email client used by recipient – Gmail, Yahoo etc, and the operating system of the recipient.
Setting up a Webhook with Pepipost
Pepipost provides webhooks as a feature to extend your custom application by utilizing data from our system. When you send transactional emails to your customers using the Pepipost platform, a lot is happening at the back end. Our webhooks are a convenient way to facilitate quick information exchange with your application. Here are the basic steps to configure a webhook with Pepipost:
- Select the data you want to use: First and foremost, you need to drill down to the data that your application would need from our platform. Do you want to track email delivery or email engagement? Accordingly, make a list of the metrics and events that need to be triggered and configured with our webhooks.
- Setup the URI: Next, you need to setup / configure the URL. In order to receive webhook data, you need to configure a URI that can receive this data. Moreover, you need to point this URI to your application, which would be the end-point of data consumption.
- Write scripts to capture data: In your application, you need to write scripts to consume data from the URI and utilize it as required.
- Configure URI in Pepipost: Finally, you need to configure the Call back URL in Pepipost to start sending data to your application via POST. Our webhooks allow you to sync-up with subscribers activities and receive real-time HTTP POST call-backs.
Using webhooks from your ESP? Keep these points in mind
There are multiple aspects that you must remember to ensure that your applications are utilizing webhooks to the fullest.
- Webhooks might stop forwarding requests at times. They might even forget to handle a request after generating it. This means that your Webhook has a configuration error. You must correct it as soon as possible to avoid loss of data. Pepipost filters out such requests quickly and avoids data duplicacy.
- You cannot ascertain how many requests will come to your app. Therefore, you must test whether your webhook can handle a large number of requests. You can check this well in advance so that your app does not stop functioning if there are a large number of incoming requests.
In conclusion, it is important to understand how a typical email webhook works, so that you can derive the maximum benefit out of it. Use Pepipost webhooks to receive real-time data about email delivery and email engagement in your application and procure actionable insights into your email marketing campaigns.
Found this blog useful? Please rate us
The next time you log into Gmail you may notice a small red padlock next…Read More