Webhooks & Queued Delivery
Headless notifies external frontends, static site builders, and partner backends whenever ProcessWire pages, Entries, or custom module events change.
How WebhookDispatcher Delivers Events
Section titled “How WebhookDispatcher Delivers Events”- Signing (
whsec_*): Every webhook entry inheadless-webhooksis provisioned with a write-onlywhsec_signing secret used to compute an HMAC-SHA256 signature header on outbound JSON payloads. - SSRF & Pinned-IP Hardening:
WebhookDispatcher::isValidHttpUrl()andbuildHttpTransportOptions()validate public HTTP/HTTPS targets, block private/loopback/metadata IPs, and pin the resolved IP on the HTTP transport to prevent DNS rebinding. - Header Sanitization:
WebhookRepository::sanitizeCustomHeaders()stripsRESERVED_WEBHOOK_HEADERSand markscustom_headerssensitive so secrets never appear in API responses or CSV/JSON exports. - Queued vs. Synchronous Delivery (
DeliverHeadlessWebhookQueue):- When
trk/processwire-consolequeues are available (shouldQueue()returnstrue),WebhookDispatcher::dispatch()enqueuesProcessWire\DeliverHeadlessWebhookQueue(webhook_id,event,timestamp,data) so page saves never block on remote HTTP timeouts (default2.0s). - Run
php vendor/bin/wire queue:work(or inspect in Setup -> Console -> Queues) to process queued deliveries.
- When
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',]);