Tools & Infrastructure

Webhooks Demystified

How apps send each other messages instantly — without anyone lifting a finger.

Scroll to start

What Is a Webhook?

Think of a webhook like a text message between two apps. When something happens in one app — like a new customer signing up — it doesn't wait for the other app to ask. It just sends the news right away.

A webhook is a tiny signal that one app sends to another when something specific happens. It carries a small package of data (usually in JSON format) and fires off the moment the event takes place. No waiting, no asking — just automatic delivery.

The place a webhook gets sent to is called a webhook endpoint — basically a web address (like https://yoursite.com/hooks/order) that your app keeps open, listening for incoming news.

The App World Runs on Webhooks

Every time you get a Slack message the instant someone fills out your website form, a webhook fired. When your online store sends you a notification that a new order just came in — that's a webhook too. Payment apps, chat tools, email platforms, and thousands of other services all use webhooks to stay in sync without any human involvement.

Before webhooks, apps had to constantly ask each other "any news? any news? any news?" — a process called polling. That wastes a lot of energy checking for nothing. Webhooks flip that around: only send a message when there's actually something to say.

💡 Key Insight

Webhooks are why your apps feel "smart" — they respond to things the moment they happen, not minutes or hours later. Without webhooks, every tool you use would need to constantly ask every other tool if anything new happened.

The Webhook Journey in 4 Steps

Here's what happens when a webhook fires — broken down into four simple steps:

How a Webhook Travels
Event
Something happens — like a new signup
📦
Package
App wraps the data into a payload
🚀
Deliver
Webhook fires to your endpoint URL
Process
Your app receives and acts on the data
repeat

The whole thing usually happens in under a second. Your app gets the data, does something useful with it (sends an email, updates a spreadsheet, logs the event), and the webhook sender gets a small "200 OK" confirmation back — like a read receipt.

A Simple Webhook Receiver

Here's a tiny Node.js app that listens for a webhook. When it receives one, it prints the data and sends back a confirmation. This is the kind of code that powers everything from order notifications to automated emails.

server.js
const express = require('express');
const app = express();

// This is your webhook endpoint — where incoming hooks land
app.post('/webhook', (req, res) => {
  const data = req.body;
  console.log('Webhook received:', data);

  // Do something useful with the data
  // e.g., save to database, send an email, update a dashboard

  res.sendStatus(200); // Tell the sender: "Got it!"
});

app.listen(3000, () => {
  console.log('Webhook receiver running on port 3000');
});

That's it — less than 20 lines of code. Your endpoint is now live and listening. When Stripe sends you a payment webhook, when a form fills out via Typeform, or when GitHub tells you a deployment is done — this is the kind of code that catches all of it.

Knowledge Check

Test what you learned with this quick quiz.

Quick Quiz — 3 Questions

Question 1
What is a webhook, in simple terms?
Question 2
What is the opposite of a webhook — the slow way apps used to check for new information?
Question 3
What does a receiving app send back after successfully getting a webhook?
🏆

You crushed it!

Perfect score on this module.