What Are Webhooks?

Gage Thornberry
2 min readAug 16, 2020

What is a Webhook? Let’s ask Wikipedia -

“A webhook in web development 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. The term “webhook” was coined by Jeff Lindsay in 2007 from the computer programming term hook.”

-Wikipedia

A webhooks can be used if you want to be notified about something new or when things change in your database.

A simple example of a webhook would be a notification on social media. Your friend Josh commented on your photo, and when he did you were instantly sent a notification that told you who commented and when it happened.

The method in which webhooks can be implemented are through HTTP requests. But before you can receive a notification, you must first send your credentials and establish a relationship (or subscription) to receive said messages.

When sending the first POST request from the client (you) to the provider, the provider is going to want to authenticate your request so it can avoid notifying a hacker about your information.

This can be done in many different ways -

The provider can keep a list of IP addresses for their clients.

Basic HTTP auth can be implemented to authenticate the client.

The HTTP request can contain an HMAC signature in the header that only the client and the provider could know. (Github and Stripe use this)

Your own form of signatures can be performed, although it’s not recommended (HMAC is safer).

All of these things have the potential to be viable methods to authenticate the client with the provider.

Once subscribed, your server will be sending and receiving information in the form of regular HTTP requests. Using webhooks can help make for a really unique project.

I’m about to implement them in a personal project that I’ve started involving recording data analytics and visualizing that data.

This has been a short and to the point introduction to using webhooks.

Thanks for reading!

--

--