Engineering

Webhook

A webhook is an HTTP callback — a real-time notification sent from one application to another when a specific event occurs, without the receiving application needing to continuously poll for updates.

In depth

Think of webhooks as 'push notifications for APIs.' Instead of your app asking 'did anything happen?' every few seconds (polling), webhooks have the other service proactively call your app when something happens.

Common webhook use cases: - Stripe sends a webhook when a payment succeeds or fails - GitHub sends a webhook when code is pushed to a repository - Shopify sends a webhook when an order is placed - Twilio sends a webhook when an SMS is delivered

Webhook structure: the source service makes a POST request to a URL you provide, with a JSON payload describing the event. Your app receives the POST, processes it, and responds with 200 OK.

Security: always verify webhook signatures. Stripe, for example, includes a signature header that you verify against a secret to confirm the webhook is genuine and not a forged request.

Polling vs webhooks: polling is simpler but wastes bandwidth and introduces latency. Webhooks are more efficient but require your server to be reachable and capable of handling the incoming request.

Real example

When a user's Stripe subscription renews, Stripe sends a webhook to https://yourapp.com/api/webhooks/stripe with the event `invoice.payment_succeeded`. Your app receives it, marks the subscription as active, and sends a receipt email — all in real time, without polling Stripe every minute.

Related terms

Ready to build your product?

Fixed price. 21-day delivery. Senior team.

Get a free scoping call →

Browse the glossary