Skip to content

Webhooks & Queued Delivery

Headless notifies external frontends, static site builders, and partner backends whenever ProcessWire pages, Entries, or custom module events change.

Outbound Webhooks manages whsec_-signed endpoints, subscribed event lists, custom headers, and last delivery HTTP status.
  1. Signing (whsec_*): Every webhook entry in headless-webhooks is provisioned with a write-only whsec_ signing secret used to compute an HMAC-SHA256 signature header on outbound JSON payloads.
  2. SSRF & Pinned-IP Hardening: WebhookDispatcher::isValidHttpUrl() and buildHttpTransportOptions() validate public HTTP/HTTPS targets, block private/loopback/metadata IPs, and pin the resolved IP on the HTTP transport to prevent DNS rebinding.
  3. Header Sanitization: WebhookRepository::sanitizeCustomHeaders() strips RESERVED_WEBHOOK_HEADERS and marks custom_headers sensitive so secrets never appear in API responses or CSV/JSON exports.
  4. Queued vs. Synchronous Delivery (DeliverHeadlessWebhookQueue):
    • When trk/processwire-console queues are available (shouldQueue() returns true), WebhookDispatcher::dispatch() enqueues ProcessWire\DeliverHeadlessWebhookQueue (webhook_id, event, timestamp, data) so page saves never block on remote HTTP timeouts (default 2.0s).
    • Run php vendor/bin/wire queue:work (or inspect in Setup -> Console -> Queues) to process queued deliveries.

Registering & Dispatching Custom Webhook Events

Section titled “Registering & Dispatching Custom Webhook Events”
// 1. Register custom event names inside Headless::registerProviders
$headless->registerWebhookEvents([
'charter.booking.confirmed' => 'Charter booking confirmed',
'charter.hold.expired' => 'Charter option hold expired',
]);
// 2. Dispatch from your module or hook
$dispatched = $headless->webhookDispatcher()->dispatch('charter.booking.confirmed', [
'booking_code' => 'CH-2026-S003',
'yacht_ref' => 'MY-00001',
]);

Next steps