What Is a Webhook? A Simple Explanation
Webhooks explained with the doorbell analogy, a real payload example, and the three rules for receiving them reliably.
Muhammad Usman
July 5, 2026 · 2 min read
An API is you asking a service for something. A webhook is the reverse: the service calls you when something happens, so you do not have to keep asking.
The doorbell analogy
Without a doorbell you would check the door every minute in case someone is there. The doorbell means visitors notify you. A webhook is a doorbell for software: when an event happens, the service sends a request to a URL on your server with the details.
What a webhook actually looks like
It is a normal HTTP POST to a URL you registered, carrying the event as JSON. Here is a simplified Stripe example:
POST https://yourapp.com/webhooks/stripe
Content-Type: application/json
{
"id": "evt_1Nab...",
"type": "invoice.paid",
"data": {
"object": {
"customer": "cus_9x8y...",
"amount_paid": 4900,
"status": "paid"
}
}
}And a minimal receiver on your side:
// Express example
app.post('/webhooks/stripe', (req, res) => {
const event = req.body
if (event.type === 'invoice.paid') {
markSubscriptionActive(event.data.object.customer)
}
res.json({ received: true }) // always answer 200 quickly
})The three rules of reliable webhooks
- Verify the signature: anyone can POST to your URL, the signature proves it really came from the service
- Be idempotent: services resend events when unsure you got them, processing the same event twice must be harmless
- Answer fast, work later: return 200 immediately and do heavy work in a background job, or the sender times out and retries
Everyday examples
- Stripe rings your webhook when a payment succeeds or fails
- GitHub rings when someone pushes code, triggering your deploy
- A form tool rings your CRM when a new lead submits
- WhatsApp Business rings your server when a customer messages you
Frequently asked questions
What is the difference between an API and a webhook?+
API: you ask, they answer. Webhook: they notify you when something happens. Most real integrations use both together.
Do webhooks need a server?+
Something must be online to receive the call. Serverless functions on Vercel or similar platforms are a cheap, common way to do it without managing a server.
How do I test webhooks locally?+
Tools like the Stripe CLI or ngrok tunnel the provider’s calls to your local machine, so you can develop and debug before deploying.