October 6, 2019

What is a Webhook & How to use it to Track Email Marketing Activity

Reading time about 6 min
What is a webhook - Sendinblue blog

Ever wonder how the use of webhooks could benefit your email marketing?  This article has it covered along with essential basics including how webhooks work and how to set one up for tracking campaign and subscriber activity.


The concept of a webhook explained

A webhook is set up to send ‘push’ notifications to a designated URL when activity occurs related to a specific event.

As an example, let’s take ourselves back in time to before the existence of online banking. It’s payday and you want to check if the money has arrived in your account. You call the bank and ask them directly.

Now let’s jump back to the modern day. It’s payday, the money arrives, and the bank server sends a notification to your online account. You didn’t have to call anybody – the information you wanted was sent to you at a specific destination the moment the event occurred.

This pretty much sums up the concept of a webhook. 

How does a webhook work exactly?

Webhooks are a great way to receive real-time updates about web activity that’s important to your business.

The webhook waits for an event to occur in one system or application and subsequently transfers data to another application or system using an HTTP “POST” callback to a destination URL once the specified activity is detected .

This URL has to be public and belong to the receiving system or application. Additionally, it has been specially configured to act as a webhook endpoint so that the system can receive the notification.

What’s the difference between a webhook and an API?

One of the main differences between webhooks and APIs is that APIs work by ‘polling’ – a process by which your server makes a request to the API server to check for new data. Inversely, a webhook sends the data automatically. This is why it’s sometimes called a ‘reverse API’.

This method is far more efficient than constantly checking an application to see if there has been a change – and therein lies the major advantage of a webhook.

The difference between Polling and Webhooks
Source: Esri

Using a webhook to track email marketing activity

Let’s say you’re already using an email marketing service like Sendinblue to manage your email campaigns and subscribers.

Now you’re probably wondering why you’d need webhooks when using an email marketing service that has a comprehensive analytics dashboard. I mean, you can just log in to see how your campaign is doing, right?

True, but consider this scenario: You send an important email campaign and then you leave the application to do other work. In the meantime, it turns out that a large portion of your emails are either bouncing or failing to deliver. By the time you discover the issue, several hours pass and the campaign is beyond saving.

Where the webhook comes in useful here is that it will send you notifications in real-time about your campaign’s progress. 

In this case, if an issue were to arise, you would 1) know about it quickly and 2) be able to jump in immediately to investigate and resolve.

What specific email activity can I track with a webhook?

On the Sendinblue email marketing platform you can set up webhooks to receive real-time updates about the following events:

  • Marked as spam
  • Opened
  • Clicked
  • Hard Bounced
  • Soft Bounced
  • Delivered
  • Unsubscribed
  • Contact added to a list
  • Contact updated
  • Contact deleted

You can activate as many of these webhook events as you need.

When an event takes place, the notification is sent with POST to the target URL in JSON format.

Here’s what the notification will look like (taking the ‘Clicked’ event as an example):

{“id”:139911, “Camp_id”:253, “email”:”abc@example.com”, “campaign name”:”Campaign ABC”, “date_sent”:”2019-07-30 11:30:50″, “date_event”:”2019-07-30 11:39:15″, “Event”:”clicked”, “Tag”:”abc”,”ts_sent”:1564479050,” Ts_event”:1564479555, “URL”:”www.example.com”, “ts”:1564466956}

How to set up webhook with a Sendinblue

Setting up a webhook with Sendinblue is easy. Let’s run through the process.

If you haven’t configured a destination URL yet, you can generate a test URL with RequestBin.

  1. Once logged in to Sendinblue, navigate to either the Campaigns or Contacts page (depending on whether it’s campaign or contact activity you want to track)”
  2. Once on either page click Settings 
  3. Select the Webhooks option by clicking Configure 
  4. Select +Add a New Webhook 
  5. Insert the destination URL and select the events for which you wish to be notified

What can I do with the webhook data after that?

With all these webhook notifications coming at you, you might be wondering what else you can do with the data. 

Quite a lot, actually! You can create reports, synchronize two systems, or use it to trigger automated workflows (like sending a series of lead-nurturing emails to a prospect who clicked on a link).

Imagine your email got a hard bounce due to an invalid recipient address and the webhook endpoint was your company’s CRM application. You could synchronize the two systems so that the email address is automatically deleted from both (luckily, Sendinblue automatically blacklists hard-bounced contacts for you, but you get the idea ;)).

It’s important to remember though that webhooks can only notify you of a change. If you want to take action based on the notification, then you need an API (Application Programming Interface).

For a detailed explanation of how an API works, read our dedicated article.

Wrap up

More and more companies are discovering the benefits of using webhooks to save time and improve customer experience.

Webhooks are great way to get real-time updates on your email campaigns – or any kind of web event for that matter. 

Open a Sendinblue account and try out using webhooks. Not to mention you’ll get 9000 emails per month (or 300 per day) at zero cost. ?

Test-drive Sendinblue’s all-in-one marketing toolbox >>

For more content like this, subscribe to our newsletter in the sidebar or follow us on Twitter!

Ready to find your marketing zen?

Take the stress out of your work day with a solution that’s built for you!

Get started free