Webhook
Definition
An automatic notification sent between systems when something happens. Instead of constantly checking for updates, webhooks push data instantly when triggered.
What is a Webhook?
A webhook is an automatic message sent from one system to another when a specific event occurs. Instead of your website repeatedly asking "did anything happen?" (polling), the external service tells you immediately when something does (pushing).
Think of it as a doorbell versus constantly checking if someone's at the door.
Webhooks vs APIs
| API (Polling) | Webhook (Pushing) |
|---|---|
| You ask for information | Information comes to you |
| Check repeatedly | Notified when relevant |
| Uses more resources | More efficient |
| You control timing | Event-driven |
| Simple to implement | Requires endpoint |
How Webhooks Work
- You register a webhook URL with the external service
- You specify which events you want to hear about
- When that event occurs, the service sends data to your URL
- Your server receives and processes the data
Common Webhook Examples
Payment Processing
Stripe sends a webhook when payment succeeds, fails, or is refunded. Your site updates orders accordingly.
E-commerce
- Order placed – trigger fulfilment
- Shipping updated – notify customer
- Subscription renewed – update access
Form Submissions
Form services like Typeform send responses to your CRM instantly via webhook.
Git and Deployment
GitHub sends a webhook when code is pushed, triggering automatic deployment.
Email Marketing
Mailchimp notifies you when someone subscribes or unsubscribes.
Webhook Security
Since anyone could theoretically send data to your webhook URL:
- Verify signatures – services include a secret signature to prove authenticity
- Use HTTPS – encrypt data in transit
- Validate data – don't trust incoming data blindly
- Respond quickly – acknowledge receipt, process later if needed
Why Webhooks Matter
Webhooks enable real-time automation. Without them, you'd need to constantly poll services for updates – inefficient and slow. With webhooks, systems react instantly to events, creating seamless user experiences and efficient workflows.