DEV Community


Posted on

What are Webhooks?

Last night I was wondering whether I need webhooks with my application or not and then I realized that Webhooks with ngrok and Django are actually going to be great. For those of you who didn't understand my last statement specifically because of the usage of 'webhooks', this blog post is going to clarify what it means and by the end, you'll have a basic knowledge of what webhooks are, what their purpose is and how to use them.

Webhooks are essentially a chain of events to manipulate the behavior of a web app with custom callbacks.

Now, what are callbacks?

Callbacks are chunks of code that get executed at a given time and is passed as an argument to some other code.

What is the purpose of Webhooks?

For instance, you update switch your administration server to a different TimeZone specific to your app and save the changes successfully. However, for other servers to inform, you need to execute a webhook immediately telling other servers listening that the TimeZone just got updated.

Webhooks also help in deploying web applications automatically.

In this blog post, I'll walk you through a test webhook response and how a webhook actually works.

Using Webhook Tester

A Webhook tester would help you generate a unique URL to test, inspect, forward, and script incoming HTTP requests and emails with Custom Actions. A great Webhook tester is

My repository [Daily Code] is already using a Git Guardian webhook for safe code deployment but we'll be adding another webhook for testing purposes.

Alt Text

The Real Part


Alt Text

You'd wanna paste that URL from the Webhook Tester in the URL field for the webhook. Also, set the response type to JSON, and narrow your notifications to “Commit comments”.

Alt Text

Once you click on “Add webhook”, GitHub sends us a test request to ensure our server is receiving its POST requests.

Now to test for ourselves, we'd need to go make a comment on a commit.

Alt Text

Alt Text

As you can see, we've got our POST request after commenting on a commit like we had specified earlier in the webhook settings. So yeah, this is how Webhooks really work and can actually be used for various operations.

If you liked this article, it would be really nice of you to drop a comment down below, check my other articles, or maybe support my projects?

Top comments (0)