Webhooks for real-time data updates

Webhooks for real-time data updates

Introduction

What is a Webhook?

A webhook is a way for a system to notify another system of an event that has occurred. For example, that a contact was added to a list or a message was delivered.

Also known as “callbacks”, webhooks are a lightweight way to send signals and small amounts of data between applications across the internet (via HTTP).

How does it work?

What are the benefits of using a Webhook instead of an API call?

Push instead of Poll: An API (Application Programming Interface) can be very powerful, but querying it every minute or so to find out if something happened is like having someone in the backseat ask “Are we there yet?” over and over again. It distracts you from more important tasks (driving) and is wasteful since most of the time the answer is “no” (or worse). This is called polling. A better solution would be for the person in the back to take a nap, or watch a movie, and the driver can tell them once they arrive. This is called pushing.

Quick and easy to set up: If an app supports webhooks, then it often has a UI (User Interface) to make it easy to configure. This is where the client enters their app’s webhook URL and sets some basic parameters, like which event they are interested in.

Event based: As soon as the event occurs, the system sends data for that event to the relevant webhooks. This happens as quickly as possible (depending on server capability and data transmission speed) but usually happens so fast that we call it real-time.

Why are they cool?

Real time data transfer between applications

Webhooks enable your system to react, in real time, to events from another system. This reaction might be as simple as displaying a pop-up notification, or to start an important automation.

Another way of looking at it, is that webhooks allow you to extend the capabilities of your system by plugging into specialised 3rd party systems (e.g. billing, marketing and messaging) whilst staying responsive.

Here’s another example:

  • The purchase event is sent via three webhooks to billing, shipping and inventory.
  • Billing raises an invoice.
  • Shipping robots locate the item by its unique ID.
  • Inventory responds by ordering more items if stock is getting low.

A sample webhook payload

What does it look like?

Webhook data is sent as a HTTP request to the receiving URL.

We will use Webhook.site to demonstrate an example with Burst SMS. Webhook.site is a great and free tool for testing webhooks.

https://webhook.site/76e4c843-741b-4461-896c-3d4dec772d94

We will use this as the receiving URL for when a contact is added to Burst SMS. Webhook.site will display the requests in real-time as they arrive.

We enter this URL into the originating application. In this case the Burst SMS list.

When we add a contact to the list, the webhook is “Notified” and the data is transferred.

The system adds the relevant data as parameters, for example:

https://webhook.site/76e4c843-741b-4461-896c-3d4dec772d94?type=add&list_id=6945740&mobile=61438333061&firstname=Brad&lastname=Down&datetime_entry=2022-11-30%2022%3A53%3A19&gender=M&email=braddown%40gmail.com&dob=18%2F12&active=Y&user_id=54911&rate=10

This is sent by the webhook to the receiving URL. Webhook.site displays the raw data to show that it works, but a purpose built application can use that data to trigger automations, sync data etc.

Getting started with Webhooks

When evaluating online services, check if they support webhooks

Not all online services support webhooks. They are an extremely useful tool when it comes to integrations and making sure data is portable between services.

Always check to see if the services you are evaluating like CRM’s and Support Systems support Webhooks. This will simplify your capability of transferring data between your different systems.

For more information about Burst SMS webhook support review our documentation here:

https://developer.transmitsms.com/#http-callbacks