Get in Touch
Close

Your Cloud Story,
Engineered for Success

Contacts

US Office: Obsium, 6200,
Stoneridge Mall Rd, Pleasanton CA 94588 USA

Kochi Office: GB4, Ground Floor, Athulya, Infopark Phase 1, Infopark Campus Kakkanad, Kochi 682042

+91 9895941969

hello@obsium.io

Webhook

Webhook

Understanding Webhook

A webhook is sometimes described as a “reverse API”: instead of a client repeatedly polling a server and asking whether anything new has happened, the server pushes an HTTP request to a URL the client has registered, the moment an event actually occurs. This event-driven push model is far more efficient than polling, since no requests are wasted asking about events that have not happened yet.

How It Works

A consuming system registers a callback URL, an HTTP endpoint it controls, with the source system. When a relevant event occurs, a git push, a completed CI build, a processed payment, the source system sends an HTTP POST request to that URL carrying a payload, usually JSON, describing what happened. The receiving endpoint parses the payload, does whatever processing is needed, and typically responds quickly with a 2xx status code to acknowledge successful receipt. If the source system does not receive that acknowledgment, most implementations retry delivery with some backoff strategy, though not indefinitely.

Example

A GitHub repository is configured with a webhook that sends a POST request to https://ci.company.com/hooks/github on every push event. The CI server’s endpoint receives the payload, extracts the branch name and commit SHA, and triggers a new build for that commit. In another common pattern, Prometheus Alertmanager sends a POST request to a Slack incoming webhook URL when an alert fires, and Slack’s endpoint formats that payload into a readable message posted to a channel automatically.

Security Considerations

Because a webhook endpoint is a public HTTP URL, it needs to verify that incoming requests genuinely came from the expected source rather than being spoofed by an attacker who guessed the URL. Providers typically sign payloads with an HMAC computed from a shared secret, for example GitHub sends an X-Hub-Signature-256 header, and the receiving endpoint recomputes the signature and rejects the request if it does not match. Endpoints should also enforce HTTPS, validate the payload structure before acting on it, and, for sensitive events, use timestamps or nonces to protect against replayed requests.

Why Webhooks Are Central to DevOps Toolchains

Webhooks are the glue connecting otherwise independent tools into an automated toolchain: a git host triggers a CI build, a CI pipeline notifies a chat channel, a monitoring system opens an incident in a paging tool, a container registry push triggers a GitOps controller like Argo CD to sync a new deployment. This event-driven wiring lets systems react instantly to changes elsewhere in the toolchain without any component needing to poll another for status.

Trade-offs and Limitations

Webhook delivery is not guaranteed; network failures can drop a delivery, and while most providers retry with some backoff, they do not retry forever, so a receiving endpoint that is down for an extended period can silently miss events. There is no built-in ordering guarantee when multiple webhook deliveries arrive close together. Debugging is harder than with a normal API call, since delivery is fire-and-forget from the sender’s perspective, and the receiving endpoint must be publicly reachable, which is why local development often relies on a tunnel such as ngrok or smee.io to receive webhooks on a machine that is not otherwise internet-accessible.

Best Practices

  • Always verify the signature on incoming webhook requests before trusting or acting on the payload.
  • Make webhook handlers idempotent, since a retried delivery of the same event should not cause the action to be performed twice.
  • Respond quickly and move heavy processing to an asynchronous queue, so the acknowledgment is not delayed and the source system does not time out and retry unnecessarily.
  • Log raw incoming payloads to support replay and debugging when something goes wrong downstream.
  • For high-volume or business-critical webhooks, consider a dedicated webhook management platform that adds retry logic, dead-letter queues, and delivery visibility.

Frequently Asked Questions

What is Webhook?

A webhook is an HTTP callback that automatically pushes an event notification, usually as a POST request with a data payload, from one system to a URL registered on another system the instant a specific event occurs.

How does Webhook work?

Webhook works by combining the components described in the sections above. The main page walks through the architecture, the typical use cases, and the trade-offs to weigh before adopting it.

Why does Webhook matter?

Teams adopt Webhook to ship faster, run more reliably, and reduce the cognitive load on engineers. The benefits, limits, and adjacent tools are covered in the body above.

When should you use Webhook?

Use Webhook when the problems it solves match what your team is hitting today. The page above outlines the signals that mean you should adopt it now, and the cases where a simpler approach is fine.