Vezi pagina în română

IT Glossary

What is a Webhook?

A webhook is the automatic notification one application sends another, as an HTTP request, the moment an event happens.

6
sections
6
questions answered

A webhook (also called a web callback) is a URL in your system that another application calls automatically, with an HTTP POST request carrying the event data, the moment something happens: a payment cleared, a new order, a parcel delivered. The opposite is called polling: your system asks at intervals "anything new?" and learns of the event up to one interval late. Not every service offers webhooks: the Romanian ANAF e-Factura API sends no notification at all, so an invoicing program has to ask for the status of each invoice (stareMesaj) and for the list of messages from the last 1 to 60 days (listaMesajeFactura).

For a buyer, the difference between an integration that is "real time" and one that "syncs every 15 minutes" is often exactly the difference between webhook and polling. That makes "do we receive events by webhook or poll periodically?" a fair question on any integration quote, and when choosing a SaaS, webhooks in the documentation are as concrete an integrability criterion as price.

Why it matters for your business

Real time instead of "at the next sync"

Events land in your systems within seconds — the payment releases the order, the lead triggers the alert, the status reaches the customer, all without the sync-interval lag.

Efficiency without wasted questions

Polling that asks every few minutes "anything new?" disappears — the infrastructure works on events, not on hunches.

The universal brick of automation

Every "when X, then Y" between applications builds naturally on webhooks — the foundation on which automation platforms and custom integrations assemble your workflows.

How a webhook works

First you register your URL with the provider and pick the event types you care about. At each event the provider sends a POST with JSON data over HTTPS: Stripe, for example, requires registered endpoints to be public and secured with HTTPS.

Your system checks the signature and answers with a 2xx code as fast as possible, doing the heavy work afterwards: Stripe asks for the 2xx "before any complex logic" that could time out, and GitHub counts a delivery as failed if no response arrives within 10 seconds. The same event can arrive twice and in no guaranteed order (Stripe), so the receiver keeps the IDs of events it already processed.

Webhook examples

The payment processor announces the charge (at Stripe, the payment_intent.succeeded event) and the store releases the order in seconds. The e-commerce platform announces a new order: inventory reserves stock and the invoice starts. The courier announces a status change and the customer is notified. A form sends the lead to the CRM and alerts the salesperson.

Automation tools such as n8n, Make and Zapier start a flow from a "Webhook" trigger: every "when X happens, do Y" usually has a webhook at the X end.

Want an estimate for your project?

Message us on WhatsApp. We reply the same working day, and the first 30-minute call is free.

Book a free call

Webhook, polling and API: the difference

Through an API, your system asks for data when it needs it. Through a webhook, the other system tells you when something happens. Polling is an API call repeated on a schedule. Mature integrations use all three: the webhook brings the event, the API brings the full record, and a periodic poll catches what was missed. The usual style of the API side is REST. The API key authenticates your calls to the provider, while a webhook is authenticated by a separate signing secret (at Stripe, it starts with whsec_). The payment processor confirms the payment to the shop through a webhook. A WebSocket keeps a connection open with the browser, whereas a webhook is a one-off call between servers.

The e-Factura example shows why the polling interval is a design decision. ANAF's published limits: 1,000 calls per minute across all methods, at most 100 queries per day for the same message at /stare, and at most 1,500 queries per day per CUI on the simple list. The limits can change, so check the ANAF document.

Signing, retries and what to ask the provider

Signing: the provider adds an HMAC SHA-256 signature in a header (at Stripe, the Stripe-Signature header) together with a timestamp. Stripe's libraries reject events older than 5 minutes by default, to stop the replay of an intercepted request. Retries: Stripe retries delivery for up to 3 days with growing pauses in live mode, and 3 times over a few hours in a sandbox; GitHub never redelivers a failed delivery automatically, so you redeliver after an outage.

Three questions for any provider or bidder: what happens if our system was down when the notification came, do you validate webhook signatures, where do failed deliveries show up. A fourth: what do you do with duplicate events?

Frequently asked questions

What distinguishes an API from a webhook?

The direction of initiative: through an API, your system asks ("give me today's orders"); through a webhook, the external system announces ("here's a new order"). They complement each other: the webhook brings the event instantly, the API brings the details. Mature integrations use both together.

What happens to events if our system was down?

It depends on the provider: Stripe retries delivery for up to 3 days, GitHub does not retry automatically at all. That is why a correct implementation adds a periodic API poll that catches missed events and a delivery log with an alert on failures.

Could someone send us fake webhooks?

Yes, if the signature is not verified: the webhook address is public. Serious providers sign every request (Stripe: HMAC SHA-256 with a secret per endpoint), and your system rejects requests without a valid signature or older than a few minutes. An announced payment is also confirmed in the processor's account before delivery.

Does the ANAF e-Factura API have webhooks?

No. The RO e-Factura web services documented by the Ministry of Finance (upload, stareMesaj, listaMesajeFactura, download, validation) send no notifications. The invoicing program periodically asks for the status of each invoice and for the list of messages from the last 1 to 60 days, within the call limits ANAF publishes.

Why do we receive the same webhook twice?

Because after a timeout or an error the provider resends the same event; Stripe says your endpoint might occasionally receive the same event more than once. The receiver keeps the IDs of events already processed and skips them, so an order is not delivered or invoiced twice.

How do you test a webhook before launch?

With the provider's test mode: at Stripe, the command stripe listen --forward-to localhost:4242/webhook forwards sandbox events to your machine, and stripe trigger payment_intent.succeeded fires one. An inspection URL such as webhook.site shows the raw request. Also test failure: endpoint down, bad signature, duplicate event.