Skip to main content
Signocore

What is a webhook?

A webhook is an HTTP request that one application sends to another automatically when something happens. Instead of asking a service again and again whether anything is new, you give it a URL, and the service calls that URL the moment an event occurs: a payment succeeds, an order is placed, a form is submitted or code is pushed to a repository.

Webhooks and APIs

An API answers when you ask. A webhook speaks when there is news. Checking an API every few minutes, called polling, wastes requests when nothing has changed and still learns about events late. A webhook delivers each event as it happens. The two often work together: a webhook says that an order changed, and the receiving app calls the API for the full details.

How it works

The receiving application exposes an endpoint, an ordinary URL that accepts POST requests. You register that URL with the sending service and choose which events to receive. When an event occurs, the service sends a request with the event data, usually as JSON. Stripe, GitHub, Shopify and WooCommerce all deliver events this way.

Building a reliable receiver

  • Verify the signature. Anyone who knows the URL can send requests to it. Most services sign each request with a shared secret, often as an HMAC in a header, and the receiver should reject anything that does not match.
  • Respond quickly. Return a 2xx status within a few seconds and do slow work afterward, for example in a queue. Senders treat slow responses as failures.
  • Expect retries and duplicates. Most senders retry failed deliveries, so the same event can arrive twice. Use the event's ID to process it only once.
  • Do not rely on order. Events can arrive out of sequence. Check timestamps or fetch the current state from the API.
  • Use HTTPS. Event data often includes personal or payment details.

Webhooks drive much of everyday automation, from a chat message for every new sale to a site rebuild for every content change. Set up carefully, they are the most efficient way for two systems to stay in sync.

Also known as

Web hook HTTP callback

Have a question?

Get in touch if you'd like to learn more about this topic.