Webhook contracts and signatures
A webhook adapter receives an event payload and separate delivery configuration through WebhookDispatcherInterface::dispatch(array $webhookConfig, array $payload): void. The HTTP adapter serializes that payload, signs the exact bytes it sends and submits a JSON POST request.
This reference distinguishes the graph subscription, the projected webhook event and the HTTP delivery. Configuring webhooks develops the setup procedure; delivery, retries and queues develops processing and recovery.
Subscription and adapter configuration
Section titled “Subscription and adapter configuration”A graph, node or edge subscription uses WebhookConfig:
| Field | Type | Requirement |
|---|---|---|
url |
string |
Required HTTP or HTTPS URL with a host. Whitespace/control characters, credentials in the URL and fragments are rejected. |
events |
list<string> |
Required nonempty list. Each event name must be nonempty and have no surrounding whitespace. Matching is exact and case-sensitive. |
secret |
?string |
Optional. null means no signature. An empty string is invalid. |
WebhookConfig::fromArray() rejects additional fields. In particular, arbitrary HTTP headers are not a persisted graph-subscription field. Direct delivery configuration passed to WebhookDelivery can contain a string-to-string headers map; the adapter validates header names and values and rejects duplicates ignoring case.
For an edge event, resolution checks the edge’s subscriptions, then its source node, then the graph. For a node event, it checks that node, then the graph. For each event, all matching subscriptions at the first matching level are selected. The remaining levels do not add more recipients. Invalid node/edge references produce no matching delivery.
The subscription schema accepts nonempty event-name strings. WebhookRuntimeListener projects only the five event names below; naming another event in a subscription does not make the listener emit it.
Webhook event catalogue
Section titled “Webhook event catalogue”| Webhook event | Runtime source | Event-specific fields |
|---|---|---|
execkernel.node.enter |
runtime.session_started or runtime.node_visited |
node_id: int |
execkernel.edge.traverse |
navigation.session.updated |
edge_id: int, from: int, to: int |
execkernel.session.update |
runtime.session_started or navigation.session.updated |
node_id: int |
execkernel.node.terminal |
terminal.reached |
node_id: int, outputs: array |
execkernel.rule.block |
navigation.condition.fail during choose or navigate |
edge_id: int, rule: string, reason: ?string, ek_code: ?string, rule_context: array |
The first four are result notifications. execkernel.rule.block reports a diagnostic evaluation against candidate context, including proposed updates; it does not assert that a transition or state write succeeded. Resuming a session is not a new node-entry or terminal webhook.
The runtime listener checks graph code and revision, the session shape, operation/event identities and the expected phase before projecting an event. It does not convert an arbitrary uncorrelated array into a webhook. The event catalogue describes those runtime fields.
Common payload fields
Section titled “Common payload fields”| Field | Type | Meaning |
|---|---|---|
event |
string |
One of the projected webhook event names. |
version |
string |
Webhook payload format, currently "1.0". |
graph |
string |
Canonical graph code. |
graph_version |
?string |
Revision to which the listener is attached. |
event_id |
string |
Identity of the projected webhook event occurrence. |
runtime_event_id |
string |
Identity of the source runtime occurrence. |
operation_id |
string |
Operation that produced the occurrence. |
timestamp |
string |
Operation timestamp formatted as UTC YYYY-MM-DDTHH:MM:SSZ. |
session_id |
string |
Session correlated with the operation. |
context_scope |
"result" or "candidate" |
Whether context describes a completed result or a candidate rule evaluation. |
context |
array |
Session context copied for this event. |
subscription_id |
string |
Selected subscription’s identity. |
delivery_id |
string |
Identity of delivery of this event to that subscription. |
The secret and transport headers remain in configuration. They are not event payload fields.
Identity and idempotency
Section titled “Identity and idempotency”| Value | Identity boundary |
|---|---|
Runtime runtime_event_id |
One runtime occurrence, distinct from another occurrence in the same operation. Runtime aliases share their source occurrence. |
Webhook event_id |
The runtime listener hashes the runtime occurrence and webhook event name. Several subscriptions can receive this same event. |
subscription_id |
The resolver hashes graph code, revision, scope, position and destination URL. |
delivery_id |
The runtime listener hashes event_id plus subscription_id. This identifies one event/subscription pair. |
| Idempotency header | The default generator hashes delivery_id plus the destination URL. It is an HTTP delivery key, not another name for event_id. |
A direct adapter call may supply its own nonempty event_id and delivery_id. WebhookDelivery::prepare() creates missing event identity with random bytes and derives a missing delivery ID from event ID, optional subscription ID and URL. Queue adapters must prepare identity before enqueueing and preserve the resulting payload for another attempt.
The idempotency header is optional, controlled by WebhookIdempotencyConfig. Your receiver decides how to record and deduplicate accepted keys. Reusing an identity and key across attempts does not establish exactly-once processing by itself.
HTTP request and signature
Section titled “HTTP request and signature”WebhookDelivery::request() encodes the body with these JSON flags:
JSON_UNESCAPED_UNICODE| JSON_UNESCAPED_SLASHES| JSON_PRESERVE_ZERO_FRACTION| JSON_THROW_ON_ERROR| Header | Contract |
|---|---|
Content-Type |
Set to application/json, replacing a configured variant regardless of case. |
Accept |
Defaults to application/json when not supplied. |
| Configured idempotency header | Added when enabled, using the configured generator. Its name cannot be Content-Type, Accept or X-ExecKernel-Signature. |
X-ExecKernel-Signature |
With a string secret: sha256= followed by the lowercase hexadecimal HMAC SHA-256 of the raw body bytes. Without a secret, absent. A caller-supplied signature header is removed and never trusted. |
The HMAC input is the body only. Do not prepend a timestamp, event ID, URL or header. Do not decode/re-encode JSON, trim whitespace, normalize line endings or append a newline before verification: each would change the bytes being authenticated.
This complete test request uses explicit test identities and the public test key reference-test-key. It is constructed through the production encoder; the body is 393 UTF-8 bytes with no trailing newline.
POST /webhook HTTP/1.1Host: receiver.example.testContent-Type: application/jsonAccept: application/jsonIdempotency-Key: bb568b03c79fcdc495479d93e49654a610a7b31e8010e8bed8e2c2a5a51a020dX-ExecKernel-Signature: sha256=2a9d28567b2a4a84389afab592de301ba6d25007a056bf4f017d734b762360daContent-Length: 393
{"event":"execkernel.node.terminal","version":"1.0","graph":"signature-contract","graph_version":"1.0.0","event_id":"event-42","runtime_event_id":"runtime-42","operation_id":"choose-42","timestamp":"2026-01-01T00:00:02Z","session_id":"session-42","context_scope":"result","context":{"reference":"R-42"},"node_id":30,"outputs":[],"subscription_id":"subscription-42","delivery_id":"delivery-42"}Use the exact body, complete request and test vector when reproducing the check. The body SHA-256 is 84c00ab1dd5f6db4fc6f6ee5276b052167f2950054883fb52f135cce2d2467e4. The HTTP representation is a fixture, not an instruction to contact the example host.
Receiver verification
Section titled “Receiver verification”Given the raw request body, the received signature header and your configured secret, this function checks the exact header format by comparing it with the complete expected value:
function verifyWebhookSignature( string $rawBody, string $signatureHeader, string $secret,): bool { $expected = 'sha256=' . hash_hmac('sha256', $rawBody, $secret);
return hash_equals($expected, $signatureHeader);}Download webhook-signature-verify.php. In a PHP HTTP handler, read php://input before decoding the body, obtain X-ExecKernel-Signature through your HTTP framework, and call this function. Decode and process the event only after it returns true.
For the vector above, verification returns true. Replacing R-42 with R-43 while retaining the original header returns false. An absent header represented as an empty string also returns false. Configure the receiver’s secret from your own settings; the published key is only a reproducible test value.
Timeout, retry and circuit contract
Section titled “Timeout, retry and circuit contract”The resilient dispatcher receives a required ResilientWebhookDispatcherConfig. These values belong to the adapter, not to the graph subscription; its constructor does not provide universal timeout/retry defaults.
| Configuration | Type and restriction |
|---|---|
timeoutMs |
Integer greater than zero; used for the cURL request and connection timeout, in milliseconds. |
WebhookRetryPolicy.maxAttempts |
Integer at least one, including the first send. |
baseDelayMs / maxDelayMs |
Nonnegative integer milliseconds. A zero maximum means no configured cap below PHP_INT_MAX. |
multiplier |
Finite float at least 1.0. Delay after attempt n is the rounded, capped baseDelayMs × multiplier^(n - 1). |
WebhookCircuitBreakerConfig.failureThreshold |
Integer at least one; counts failed deliveries after their attempts finish. |
recoveryTimeoutMs |
Nonnegative integer milliseconds before the next request can probe an open circuit. |
successThreshold |
Integer at least one; successful recovery probes needed to close it. |
WebhookIdempotencyConfig |
Explicit enabled, headerName and WebhookIdempotencyKeyGeneratorInterface implementation. |
| Transport outcome | Dispatcher behavior |
|---|---|
HTTP 200–299 |
Success; the response body does not determine acceptance. |
HTTP 408, 429 or 500–599 |
Retry while attempts remain. |
Timeout or WebhookTransportException |
Retry while attempts remain. |
| Other HTTP status, including redirects | No retry; raises WebhookRetryExceededException. cURL does not follow redirects. |
| Retryable failures exhaust attempts | Raises WebhookRetryExceededException, retaining the final failure as the previous exception. |
| Circuit open | Raises WebhookCircuitOpenException before a send. A half-open recovery call gets one attempt. |
Retries reuse the same request object, body, signature and idempotency key. The policy does not consume Retry-After or add jitter. Circuit state is held per URL within the dispatcher object; it is not a shared durable record.
A direct dispatch() caller receives delivery failures. WebhookRuntimeListener isolates a failed delivery, continues with other subscriptions and can notify its failure observer with delivery_id, event and the exception class. That observer is not an HTTP receipt. AsyncWebhookDispatcher only prepares and enqueues; durability, workers, acknowledgements and recovery belong to the queue integration.