Free, independent guides since 2010

No-code & automation

Webhooks explained: how apps notify each other

What webhooks are, how they differ from APIs and polling, a real example with a form and an automation platform, payloads, security with secrets and signatures, retries and testing.

<guide section="No-code & automation" type="article" read="1 min"/>

When someone submits a form, pays an invoice or books an appointment, other systems often need to know. Webhooks are the simplest way: the first app sends a small message to a web address you choose. See APIs for non-developers for the related concept.

Polling versus webhooks

PollingWebhook
“Any new orders?” every 15 minutes“New order!” the moment it happens
Delays and wasted requestsInstant and efficient

An example payload

JavaScript
POST https://hooks.example-automation.com/abc123
Content-Type: application/json

{
  "event": "form.submitted",
  "submitted_at": "2026-12-02T10:14:00Z",
  "fields": { "name": "Ann", "email": "ann@example.com", "topic": "quote" }
}

The receiver – an automation platform or your own script – reads the JSON and acts (see JSON and XML).

A minimal receiver in PHP

PHP
<?php
$secret = getenv('WEBHOOK_SECRET');
$body = file_get_contents('php://input');
$sig = $_SERVER['HTTP_X_SIGNATURE'] ?? '';
if (!hash_equals(hash_hmac('sha256', $body, $secret), $sig)) {
    http_response_code(401); exit;
}
$data = json_decode($body, true);
// … store or forward $data, then respond quickly
http_response_code(200);

Header names and signature methods differ per service – follow their documentation.

Security and reliability

  • Use HTTPS endpoints only.
  • Verify signatures or use long, secret URLs.
  • Validate and sanitise all incoming data.
  • Respond quickly; do heavy work afterwards.
  • Handle duplicates: the same event may arrive twice.
  • Log failures and set alerts.

Frequently asked questions

What is the difference between an API and a webhook?

With an API you ask a system for data or tell it to do something. With a webhook the system tells you when something happened. Many integrations use both.

What happens if my webhook receiver is down?

Many services retry delivery a few times. Check their documentation, and monitor your receiver for errors.