Webhooks
What is it?
A webhook is an automatic HTTP message one service sends to another when an event happens, so the receiver learns about it instantly without asking.
Explain like I'm 5
Why was it created?
Constantly polling an API to check for changes is wasteful and slow. Webhooks were created so services can push notifications the instant something happens.
Where is it used?
- Payment notifications
- Code push and CI events
- Chat and messaging integrations
- Triggering automations between apps
Why should developers care?
Webhooks connect tools together — payments, repos, chat — so developers integrating third-party services use them constantly.
How does it work?
You register a URL with a service. When the relevant event occurs, the service sends an HTTP POST with details to your URL, and your app reacts. You typically verify a signature to confirm it's genuine.
Real-world example
A payment provider sends a webhook to your server when a charge succeeds, so your app marks the order paid immediately instead of polling.
Common use cases
- Reacting to external events instantly
- Connecting third-party services
- Triggering workflows
- Avoiding constant polling
Advantages
- Real-time updates
- Less wasteful than polling
- Simple to integrate (just an endpoint)
- Decouples systems
Disadvantages
- Your endpoint must be reachable and reliable
- Need to verify authenticity
- Must handle retries and duplicates
- Harder to test locally
When should you use it?
When you want to react immediately to events in another service.
When should you avoid it?
When you can't expose an endpoint, or you need to pull data on your own schedule.
Alternatives
Related terms
Interview questions
Beginner
- What is a webhook?
- How is it different from polling?
Intermediate
- Why verify a webhook signature?
- How do you handle duplicate webhook deliveries?
Senior
- How do you make webhook processing reliable and idempotent?
- How would you test webhooks during development?
Common misconceptions
- "Webhooks and APIs are unrelated" — a webhook is an API call, just initiated by the sender when an event occurs.
- "Webhooks always arrive exactly once" — they can be retried, so handle duplicates.
Fun facts
- Webhooks are sometimes called 'reverse APIs' because the provider calls you.
- Most providers sign webhook payloads so you can confirm they're authentic.
Timeline
- 2007 — The term 'webhook' is popularized
Learning resources
Quick summary
A webhook is an automatic HTTP callback that pushes event notifications from one service to another instantly, replacing wasteful polling.
Cheat sheet
- Event-triggered HTTP callback
- Push, not poll
- Register a URL to receive POSTs
- Verify signatures; handle duplicates