What is a webhook?

DEFINITION

A webhook is an automated HTTP message one app sends to a URL you provide when a specific event happens, such as a new order, payment or form submission.

A webhook is a way for one system to notify another the moment something happens. You give a service a URL on your server, called the webhook endpoint, and choose which events you care about. When an event occurs, the service sends an HTTP POST request to that URL with details in a JSON payload.

Webhooks are sometimes called reverse APIs: instead of your system repeatedly asking whether anything changed, the other system tells you when it does.

Why webhooks matter

Webhooks enable real-time automation without wasteful polling. A payment provider can confirm a successful charge instantly, a CMS can trigger a website rebuild when content is published, and a form tool can push leads into your CRM within seconds.

They are the backbone of many no-code automations and custom integrations, connecting tools that otherwise would not talk to each other.

Example: handling a payment webhook

When a customer pays, the payment provider sends a POST request to https://example.com/webhooks/payments with an event such as payment.succeeded and the order ID. Your endpoint first verifies the request's signature header using a shared secret, proving it really came from the provider. It then marks the order as paid, sends the receipt email and responds quickly with status 200. If your server is down or returns an error, most providers retry later, so your code should handle the same event arriving twice without creating duplicate orders.

Best practices

  • Verify webhook signatures or secrets before trusting any incoming data.
  • Respond with a 2xx status quickly and move slow work to a background job.
  • Make handlers idempotent by storing event IDs so retries do not duplicate actions.
  • Log every received event to make debugging failed integrations easier.

Common mistakes

  • Accepting webhook requests without verifying they came from the real sender.
  • Doing heavy processing before responding, causing timeouts and repeated retries.
  • Assuming events always arrive exactly once and in order.

Frequently asked questions

What is the difference between a webhook and an API?

An API is something you call when you need data or want an action performed. A webhook is a call made to you automatically when an event happens. Integrations often combine them: a webhook tells you an order was created, then you call the API to fetch full details.

How do I test a webhook?

Many providers include a test or replay button in their dashboard that sends sample events. Developers also use request inspection tools or local tunneling utilities to receive webhooks on a development machine. Check that signature verification, error handling and duplicate handling all work before going live.

Are webhooks secure?

They can be when implemented correctly. Use HTTPS endpoints, verify signatures with the provider's shared secret, reject old timestamps to prevent replay attacks, and validate payload contents. Never perform sensitive actions based on unverified webhook data, since anyone who discovers the URL could send requests to it.

Need help with this?

IA e automazione by VYZEON — Mettete l'IA al lavoro in tutta la vostra azienda.

Fixed packages from $299. Written scope, no surprises.

See IA e automazione

Related terms

More Web development terms