Quick Summary
Webhooks allow applications to automatically send real-time data to other applications when specific events occur.
A webhook is an HTTP callback that occurs when something happens in an application. Instead of polling for data, webhooks push data to a specified URL when events occur, enabling real-time communication between systems.
How Webhooks Work
- An event occurs in the source application
- The source makes an HTTP POST request to the configured webhook URL
- The receiving application processes the data
- The receiving application responds with HTTP status code
Common Webhook Use Cases
- Payment notifications (Stripe, Razorpay)
- CI/CD triggers (GitHub, GitLab)
- CRM updates (Salesforce, HubSpot)
- Slack notifications
- E-commerce order updates
Webhook vs API Polling
| Webhook | API Polling |
|---|---|
| Real-time | Delayed by polling interval |
| Event-driven | Request-driven |
| Efficient | May waste resources |
Webhook Security
- Use HTTPS for encrypted transmission
- Verify webhook signatures
- Implement IP whitelisting
- Use authentication tokens
Key Points
- Real-time event notifications
- HTTP callbacks
- More efficient than polling
- Event-driven architecture
- Requires endpoint URL
- Needs security measures