The Basics of Webhooks
Webhooks are user-defined HTTP callbacks that are triggered by email events. These events are things like a successful email delivery or a link clicked in an 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. You could trigger an offer to customers “event” in your application or store data. A popular use of webhooks is to obtain data in real-time, including message effectiveness or engagement.
Webhooks are also referred to as reverse-APIs as they send information to your applications on a real-time basis, without having to ask for the data.
Email Events and Types of Webhooks
You can trigger multiple events per email sent. For example: email delivered, email bounced, email opened, email clicks. These are all events that can be tracked by email service providers such as Pepipost.
Email Delivery Webhooks are events that occur during delivery stage. They include email delivered, bounced or dropped (hard bounces or email failed to delivered due to continued soft bounces.) You can get answers to questions by configuring your webhooks:
- 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 determine:
- If the recipient open his / her email
- Whether the recipient clicked within the email
- If there was an unsubscribe
How to use Webhooks
Webhooks deliver to an URL, so, the first step in setting up a webhook is to give it the name of your URL. You can use a back panel or API to do this. For implementing a webhook, you need an URL in your app that is accessible through the public web. Common data posting methods are JSON and form data. Your provider will give an option to pick whichever you want. Both these methods are easy to understand and implement. Just make sure that you secure your URL before making it public with an https and before implementingwebhooks
Common Parameters / Data sent via Webhooks
All webhooks 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.
Uses of Webhooks
Webhooks can make your web more programmable in three primary ways:
Push: This means receiving data in real-time.
The most compelling reason to use webhooksis Push. You don’t have to keep polling every other second to update your information. All you have to do is create a webhook and you will come to know about the information the minute it is up on the internet.
Pipes: This means receiving data and passing it on.
Pipes make your webhooks more meaningful. Every time you get new data, webhooks will not only notify you but also go a step further and trigger a new action which is different from the original event. For example, you can create a Twitter script and wire your webhook to launch that script every time you bring out something new on your website.
Plugins: This means to process data and give something in return for it.
If you want others to extend your application, create a webhook plugin. The webhookwill modify the data of the web application sending the data based on the response it gets. Popular web platforms like Facebook and Google Wave use this form of webhooks
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.And, since webhooks are getting more applicable, you don’t have to worry about it being too complicated to integrate.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.
Find out more about our features!