What is a webhook? Putting it into practice.
Webhooks are used to integrate various services when coding. But what is a webhook? In this article we’ll explain what webhooks are and what they are used for.
A webhook is a POST request handler. It waits to be called to perform a certain action.
I will explain more clearly on an example. I sell my courses through Paddle. When someone signs up for a course, a webhook is called with JSON data. This data includes the customer’s mail and name, as well as the name of the product.
The webhook is responsible for adding the customer to the Airtable database and sending a confirmation email with the necessary information.
In my case, the webhook is a Node.js application with the Express framework, but in general it can be any application that is accessible via the Internet and is capable of receiving network requests. I placed the webhook on a VPS, although I could have limited it to serverless function.
Basically, all payment systems offer webhooks to process the payment and perform the actions you want.
Another example of using webhooks is to run certain tasks on your computer. For example, all deployment platforms offer webhooks that are called to start a new deployment.
I use one in Netlify or Cloudflare Pages. I have an IFTTT task: every day at 8am it triggers a deployment to publish a scheduled blog post (trigger condition: publication date passed).