What does webhook mean?
A webhook is a "reverse" API call: instead of your app asking another app for data, the other app calls your app with the data when something happens [1].
GitHub’s documentation describes the idea plainly: you specify a URL and the events you care about, and when one of those events happens, GitHub sends an HTTP request with the event data to that URL [1]. Every service that offers webhooks works the same way.
Three parts make a webhook:
| Part | What it is | Example |
|---|---|---|
| Event | The thing that happened | A payment, a new subscriber, a new comment |
| URL (endpoint) | The address that receives the message [1] | An address your email tool or automation tool gives you |
| Payload | The data sent about the event [2] | Who bought, what, when |
Webhooks are the plumbing behind a lot of automation: "when X happens in one app, do Y in another".
How does a webhook work? A worked example
You give the sending app a URL and pick events. When an event happens, the app sends an HTTP POST to that URL; your receiving app reads the data and replies with a success code [2].
Step by step
- Register. In the sending app, paste the receiving URL and choose the events, once [1].
- Event. Something happens, for example a new issue is opened [2].
- Delivery. The app sends an HTTP POST to your URL. The body is usually JSON [2].
- Response. Your server answers quickly with a success code. GitHub, for example, expects a 2XX response within 10 seconds, or it counts the delivery as failed [3].
What a payload looks like
GitHub’s example payload for a new issue carries an action field such as "opened", plus objects describing the issue, the repository and the sender [2]. Headers name the event type (X-GitHub-Event) and give each delivery a unique id (X-GitHub-Delivery) [2]. A sale in a store tool would carry the same kind of thing: the event name, the product, the buyer’s email and the time.
A creator example (an example, not one specific tool)
Your checkout tool sends a webhook on every purchase. Your email tool receives it and adds the buyer to a "customers" list, which starts a welcome drip campaign. Nobody copies emails by hand.
What is the difference between a webhook and an API?
With an API, your app asks for data when it wants it (polling). With a webhook, the other app pushes data to you when an event happens. Webhooks need fewer requests and arrive faster [1].
| Polling an API | Webhook | |
|---|---|---|
| Who starts it | Your app, on a schedule | The other app, on an event [1] |
| Setup | Code that calls again and again | Register a URL once [1] |
| Delay | Up to the next check | Right after the event [1] |
| Cost | Many calls, can hit rate limits [1] | One delivery per event [1] |
| Best for | Data you need once in a while [1] | Reacting to events as they happen |
They are not rivals. A webhook often tells you "order 123 was paid", and your app then calls the API to fetch the full order.
How do you use webhooks safely?
Verify every delivery with a shared secret, keep the URL private, answer fast, and plan for failed deliveries, which some services do not resend on their own [1] [2].
- Use a secret. Services like GitHub sign each delivery with a secret you set, so your server can confirm it really came from them [1].
- Treat the URL like a password. Anyone who has it can send fake events unless you check the signature.
- Answer quickly, work later. Reply with a success code first, then do the slow work, so the sender does not time out [2].
- Expect failures. GitHub does not redeliver failed deliveries automatically [1]. Check the delivery log of the sending app.
- No code needed for simple jobs. No-code automation tools can receive a webhook and turn it into actions; see Zapier for creators for how creators connect apps.
Frequently asked questions
What is a webhook in simple terms?
An automatic message one app sends to another app’s web address the moment something happens, carrying the details of that event [1].
Is a webhook the same as an API?
No. With an API your app asks for data; with a webhook the other app sends data to you when an event happens, so you do not have to keep checking [1].
What is a webhook URL?
The address that receives the webhook. You paste it into the sending app and choose which events should be sent to it [1].
What format is webhook data in?
Usually JSON in the body of an HTTP POST; some services also offer form encoding [2].
Sources
- About webhooks, GitHub Docs. Accessed .
- Webhook events and payloads, GitHub Docs. Accessed .
- Handling webhook deliveries, GitHub Docs. Accessed .