// Learn

What is a webhook?

A webhook sends an automatic notification from one system to another when a specific event occurs.

The short version

Imagine you're waiting for a package. You could check the front door every five minutes (polling), or you could install a doorbell and wait for it to ring (webhooks). Webhooks are the doorbell.

Instead of constantly asking "has anything happened?", you give a system a URL and say: "when this event happens, send the details here." The system calls your URL when the event fires. No wasted requests. No delays.

How it works

Setting up a webhook has three steps:

  1. Register: you give the source system a URL (your endpoint) and tell it which events you care about
  2. Event fires: something happens (a payment succeeds, a PR is merged, a form is submitted)
  3. Notification: the source system sends an HTTP POST request to your URL with event details as JSON
POST https://your-app.com/webhooks/stripe
{
  "event": "payment.succeeded",
  "amount": 4999,
  "currency": "gbp",
  "customer": "cus_abc123"
}

Your endpoint receives this, processes it, and responds with a 200 OK to confirm receipt. If you don't respond (or respond with an error), most systems will retry a few times before giving up.

The contrast with polling:

  • Polling: "Any new orders?" "No." "Any new orders?" "No." "Any new orders?" "Yes!" → Wasteful.
  • Webhook: silence ... "New order!" → Efficient.

Common examples:

  • Stripe sends a webhook when a payment succeeds or fails
  • GitHub sends a webhook when code is pushed or a PR is opened
  • Slack sends a webhook when a message is posted in a channel

Why it matters

Webhooks are how real-time integrations work. They power payment processing, deployment pipelines, notification systems, and automation workflows. If two systems need to react to each other's events, webhooks are usually how it's done.

=++==+==++=