Skip to content

webhook

A webhook is an HTTP request that one system sends to a URL registered by another system whenever a specific event occurs, so the receiver learns about changes as they happen instead of repeatedly asking for them. It works like a callback stretched across a network, where the function being called is a web endpoint.

The setup has two halves. The consumer registers an endpoint URL and picks the events it cares about, such as a payment succeeding or code being pushed to a repository. When one of those events fires, the provider sends a POST request whose body describes the event, usually as JSON. The consumer acknowledges receipt with a 2xx status code.

This push model replaces polling, where a client queries an API on a schedule and most responses report that nothing changed. Webhooks cut that wasted traffic and deliver updates in near real time. Payment processors, code-hosting platforms, chat apps, and continuous integration services rely on them to connect independent systems.

Running a webhook endpoint raises a few recurring concerns:

  • Authenticity: The provider signs each payload with a shared secret, typically as an HMAC using SHA-256, and the receiver recomputes the signature before trusting the request.
  • Duplicates: Providers retry failed deliveries, often with exponential backoff, so the same event can arrive more than once. Receivers discard repeats by checking a unique event ID.
  • Replay attacks: A timestamp included in the signed content lets the receiver reject old requests that an attacker captured and resent.
  • Timeouts: Providers expect a fast reply, and GitHub allows only 10 seconds. Receivers often queue the payload and process it in the background.

The timeline below follows a single event through three receiver behaviors. It shows the provider backing off between retries and how checking the event ID keeps a redelivered event from being handled twice:

Interactive diagram — enable JavaScript to view.

Jeff Lindsay coined the term in 2007, adapting the programming notion of a hook to the web. The Standard Webhooks specification now aims to unify header names and signature schemes across providers.

Python API Integration

Tutorial

Python and REST APIs: Interacting With Web Services

Learn to consume web services with the requests library, then explore the tools for building a Python REST API of your own.

intermediate api web-dev

For additional information on related topics, take a look at the following resources:

Have a question about this? Mentor AI can show you examples, compare related terms, and point you to tutorials.


By Martin Breuss • Updated Nov. 12, 2026