Webhooks
Agents can emit change events for entries/products/orders.
Enablement
Set both:
PLUGIN_AGENTS_WEBHOOK_URLPLUGIN_AGENTS_WEBHOOK_SECRET
Optional tuning:
PLUGIN_AGENTS_WEBHOOK_TIMEOUT_SECONDS(default5, max60)PLUGIN_AGENTS_WEBHOOK_MAX_ATTEMPTS(default3, max10)
These can also be referenced from Agents -> Settings -> Webhooks using env-aware fields. Prefer storing real values in the environment and keeping the Settings fields as $PLUGIN_AGENTS_* references.
Dev-only test sink
For local/dev inspection without a real external receiver:
- set
PLUGIN_AGENTS_WEBHOOK_TEST_SINK=true - keep Craft
devModeenabled PLUGIN_AGENTS_WEBHOOK_URLandPLUGIN_AGENTS_WEBHOOK_SECRETremain the normal runtime webhook settings- only point
PLUGIN_AGENTS_WEBHOOK_URLat the sink URL shown inAgents -> Statusin local/dev - keep
PLUGIN_AGENTS_WEBHOOK_SECRETconfigured so signatures can be verified
The sink is a local capture endpoint:
- route:
/agents/dev/webhook-test-sink - it stores recent deliveries for inspection in
Agents -> Status - it is intentionally unavailable outside explicit dev-mode opt-in
Send test webhookissues a one-click local delivery through the real signing + HTTP delivery path- do not route production webhook delivery to the local sink
Manual CP check
For a quick operator/dev verification pass:
- set
PLUGIN_AGENTS_WEBHOOK_TEST_SINK=true - keep Craft
devModeenabled - temporarily point the normal runtime
PLUGIN_AGENTS_WEBHOOK_URLat the sink URL shown inAgents -> Status - confirm
Webhook Test Sinkappears inAgents -> Status - click
Send test webhookfor a one-click delivery check, or save an entry/product/order and runphp craft queue/runfor a real content-triggered event - confirm the sink section shows:
- captured count
- valid count
- last captured timestamp
- routing mode / matched credential handles
- payload preview
- use
Clear capturesto reset the local inspection history
Automated QA scenarios are available in:
scripts/qa/webhook-test-sink-smoke.shscripts/qa/webhook-test-sink-e2e.sh
Delivery model
- webhook jobs are queued
- retries are bounded by max attempts
- non-2xx responses are retried
- exhausted events are persisted to dead-letter queue storage for replay
Subscription targeting (per agent)
Managed accounts can include optional event-interest subscriptions:
- resource types:
entry,product,order - actions:
created,updated,deleted
Behavior:
- if no accounts define subscriptions, webhook delivery runs in firehose mode
- if any account defines subscriptions, delivery switches to targeted mode and only matching events are sent
- subscriptions are managed in
Agents -> Accounts
Signature headers
Outgoing requests include:
X-Agents-Webhook-IdX-Agents-Webhook-TimestampX-Agents-Webhook-Signature
Signature format:
sha256=<hmac>- HMAC payload:
<timestamp>.<rawJsonBody> - HMAC algorithm: SHA-256
- key:
PLUGIN_AGENTS_WEBHOOK_SECRET
Event payload shape
Typical fields:
idoccurredAtresourceType(entry|product|order)resourceIdaction(created|updated|deleted)updatedAtsnapshot(null on delete tombstones)
Dead-letter queue (DLQ) + replay
Guarded endpoints:
GET /agents/v1/webhooks/dlq(scope:webhooks:dlq:read)POST /agents/v1/webhooks/dlq/replay(scope:webhooks:dlq:replay)
Replay modes:
- replay a single event by
id - replay a batch with
mode=all(+ optionallimit)