Webhook
Definition
Method for applications to provide real-time information to other applications via HTTP callbacks, enabling seamless data integration and updates.
Use Cases
- Stripe: Notify merchants when a payment succeeds, fails, or a charge is disputed so the merchant system can fulfill orders or trigger customer emails. — Stripe sends HTTPS POST requests (webhook events such as payment_intent.succeeded) to a merchant-defined endpoint. Merchants verify the webhook signature, handle idempotency, and process events asynchronously (often via a queue) to update order state. (Near real-time order updates and automated fulfillment without polling Stripe’s API, improving customer experience and reducing integration complexity.)
- GitHub: Trigger CI/CD pipelines when code is pushed or a pull request is opened/merged. — GitHub Webhooks send event payloads (e.g., push, pull_request) to a configured URL. The receiving system validates the shared secret signature and triggers build/test/deploy workflows in tools like Jenkins, GitHub Actions runners, or cloud-native pipelines. (Faster feedback loops and automated deployments driven by repository events, reducing manual release steps.)
- Shopify: Keep external systems in sync when orders are created, paid, fulfilled, or refunded. — Shopify sends webhook notifications for topics like orders/create and orders/paid to partner endpoints. Integrations typically acknowledge quickly (2xx), then process the payload asynchronously to update ERP/CRM/inventory systems. (More accurate inventory and order status across systems with minimal delay, enabling better customer support and operations.)
Frequently Asked Questions
- What's the difference between a webhook and an API?
- An API is something you call to request data or perform an action (you initiate the request). A webhook is something you receive: another system calls your URL automatically when an event happens. Webhooks reduce the need to repeatedly poll an API for changes.
- When should I use a webhook?
- Use a webhook when you need near real-time updates from another system (payments, shipping updates, repo events), and you can expose a reliable HTTPS endpoint to receive callbacks. If you can’t accept inbound requests (network restrictions) or you need to query historical data on demand, an API pull approach may be better.
- How much does a webhook cost?
- Webhooks themselves usually have no direct cost as a concept, but you pay for the infrastructure that receives and processes them (API gateway/load balancer, compute like serverless or containers, logging, and any queues/databases). Costs scale with request volume, payload size, and processing time; some SaaS providers may also impose rate limits or plan-based limits on webhook deliveries.
Category: software
Difficulty: intermediate
See Also