What Is a Webhook and How It Works
Webhook
Updated October 7, 2025
ERWIN RICHMOND ECHON
Definition
A webhook is an automated message sent from one application to another when a specific event happens. It delivers real-time data by making an HTTP request to a predefined URL so systems can react immediately to changes.
Overview
A webhook is a lightweight way for one application to notify another about events in real time. Instead of the receiving system repeatedly asking the sender if anything changed (polling), the sender pushes a small HTTP request to a URL you control when something important happens. This makes integrations more efficient, reduces latency, and saves resources on both sides.
Think of a webhook like a doorbell: when a visitor arrives, they press the button and the homeowner is notified immediately. In webhook terms, the visitor pressing the button is the triggering event (for example, a new order), the doorbell system is the sender application, and the homeowner’s phone is the receiving endpoint URL that processes the alert.
Core components of a webhook
- Event: A specific occurrence in the sender system (new order created, payment succeeded, inventory changed).
- Payload: The body of the HTTP request containing data about the event, usually in JSON.
- Endpoint URL: The destination address provided by the receiver where the sender posts the payload.
- Headers: Metadata sent alongside the payload (content-type, timestamp, and often a signature for verification).
- Response codes: The receiving server returns HTTP status codes to indicate success (2xx) or failure (4xx/5xx), which the sender can use for retries or alerting.
Common webhook delivery patterns
- Immediate push: The sender posts to the endpoint as soon as the event happens.
- Batch delivery: For high-volume events, some systems group multiple events into a single payload to reduce overhead.
- Retry logic: If the receiving endpoint returns an error or times out, the sender typically retries with exponential backoff.
Practical examples
- Git hosting services send a webhook to your CI/CD system when new code is pushed; this triggers automated builds and tests.
- Payment processors send a webhook to your commerce platform when a charge is confirmed, allowing the system to update order status and fulfill shipments.
- Logistics platforms send inventory change webhooks to retailers so product availability updates in near real time.
Why webhooks are useful
- Real-time updates: Actions are pushed immediately, reducing delay between the event and the reaction.
- Resource efficiency: Avoids constant polling, saving CPU, bandwidth, and API request quotas.
- Simplicity: Most webhooks are easy to configure—register an endpoint and choose events to subscribe to.
Limitations and things to keep in mind
- Webhooks require a publicly reachable endpoint or tunneling service for local development.
- Network failures, downtime, and transient errors mean you still need robust retry and idempotency handling.
- Security must be built in: authenticate and validate incoming requests to avoid spoofing.
Beginner-friendly checklist to get started
- Choose an endpoint URL where the receiving application will accept HTTP POST requests.
- Register that URL with the sending system and select the events you want to subscribe to.
- Implement request verification (shared secret or signature) and TLS (HTTPS).
- Handle success and error responses properly; respond quickly and log what you receive.
- Test with real events using sandbox modes or tools like request bin and ngrok for local testing.
For someone new to integrations, webhooks are often the simplest way to add real-time behavior across systems without building complicated polling infrastructure. Once you understand the core parts—event, payload, endpoint, and verification—you can chain services together to automate workflows across commerce, logistics, payments, and more.
Real example
When an e-commerce platform marks an order as shipped, it can send a webhook to a shipping provider’s API containing the order ID and carrier information. The shipping provider receives the webhook, creates a tracking record, and immediately returns a 200 OK. If the provider’s system is temporarily down, the e-commerce platform retries, and once successful the order status is updated in the storefront, notifying the customer without manual intervention.
Webhooks are simple but powerful: a small HTTP request can trigger big automation across modern software ecosystems.
Tags
Related Terms
No related terms available