What is a webhook?

Join the 2022 Full-Stack Web Dev Bootcamp!


When writing code that integrates different services, it’s common to use webhooks.

What is a webhook?

A webhook is a POST request handler that listens for somebody to call it, and when this happens it performs some kind of work.

Let me do an example. I use Paddle to sell my Bootcamp and any time anyone signs up, my webhook is called with some JSON data.

The data includes the customer email, the customer name, the product bought.

The webhook is then responsible to add the customer to an Airtable base, and to email the customer to welcome and send them some information.

In my specific case, the webhook is a Node.js app built using Express, but it could be anything that can accept network requests, and is accessible from the Internet. I put it on a VPS, but it could also be a serverless function.

It’s common for any payment platform to offer webhooks - they process the payment, then they let you do “things” that you might need to do.

Another use case for a webhook is running tasks on a machine when you want it. For example all deployment platforms offer a webhook that you can call to trigger a new deploy.

I use that on Netlify or Cloudflare Pages. I have a IFTTT task that every day at 8AM triggers the deploy procedure, so the post that I scheduled the day before is published, as its published date is now passed.

This is key to my consistency, since I know every day at 8AM the post of my static site is going to be published. I no longer need to do it manually.

Many no-code tools allow you to use them to create automations.

They’re pretty cool.

If you think about it, webhooks are the glue that keeps the Internet together. They definitely allow me to run my business, so I’m grateful for them to exist.

Want to become a better Web Developer? Join the 2022 Web Development Bootcamp!

⭐️⭐️⭐️ Join the 2022 Web Development Bootcamp ⭐️⭐️⭐️