DEV Community

aclarembeau
aclarembeau

Posted on • Originally published at blog.jotcode.io

Integrating with webhooks, why and how?

If you've been working with enterprise software integration projects lately, you've probably heard of webhooks. But what are webhooks, what are they for, and how can I use them in my project? In this article, we will explain everything: what is a webhook and how to configure it so that it can help you integrate different applications?

What is a webhook

Before we start, let's start with a quick definition.
According to Wikipedia, a webhook is:

a method of augmenting or altering the behavior of a web page or web application with custom callbacks. These callbacks may be maintained, modified, and managed by third-party users and developers who may not necessarily be affiliated with the originating website or application

This may sound vague. But in broad terms, it is a signal, sent by one application to another application, to indicate that something has happened.

Let's take the example of an application allowing to receive emails. This one can emit webhooks (signals) to indicate to another application some events (a mail has been written, received, archived, ...)

What is the purpose of this

The main interest of webhooks is to allow you to create applications that will be "reactive", by having the possibility to respond to an event. Unlike other techniques, such as "polling", which requires frequent queries to a third-party application, in the case of webhooks, it is the application that performs the action that informs you of what has happened, allowing you to react immediately.

How to configure them

In general, this is where things get tricky. If you want to create an integration that interfaces with an application that uses webhooks, you will probably hear about elements such as an "endpoint", a "JSON payload", ...

This is exactly what you will need to configure. Remember, a webhook is a signal, sent by an application to another application. If you want to configure a webhook, you have to signal it:

  • to which web address the application should send a message (this is called the "endpoint")
  • what precise message should be sent to the third-party application (this is called the "payload", often encoded in a format called JSON)

What to put as an endpoint

The practical choice of the endpoint will depend on your use case, and what you want to achieve by integrating the webhook. You will generally have two choices:

  • Either, you link two applications together, and, agreeing on a format for your webhooks, choose to add a URL belonging to the second application as the destination "endpoint" for the webhooks of the first application
  • Or, you decide to create code yourself to react to a webhook. In this case, you will need to set up a web server that can read the different webhooks sent, and process their content.

It just so happens that this second point is where we come in. With jotcode, we offer you a simple solution to quickly create scripts that allow you, among many other things, to process webhook payloads, and perform recurring tasks, set up web servers, ... and all this, directly from your web browser.

Do you want to discover us? Learn more at https://jotcode.io

Top comments (0)