create_notification_rule
Create a notification rule — Alert someone when a delivery reaches a state: the event, optional filters, the channels, an optional template, quiet time and digest.
Creates a notification rule. event is one of success, recovered, failed_attempt, retry_scheduled, permanently_failed, skipped. webhook_id scopes the rule to one webhook (a plan may reference a webhook created earlier as {{step_N.id}}); omit it for a site-wide rule. channel_ids come from list_notification_channels. filters are all optional: attempts (which attempt numbers), http_codes ("5xx", "429", "500-504", "transport"), reason (exhausted | non_retryable, permanently_failed only), triggers ("woocommerce_*"), only_after_retry, include_tests. template is {subject, title, body, short} with {{ path | modifier }} placeholders — the shared linter checks it against the webhook's captured payload and rejects unknown paths with the list of what is available, so the model corrects itself instead of storing a template that renders blanks. throttle_seconds quiets repeats per webhook; digest batches them hourly or daily. Registered as the WordPress Ability flowsystems-webhook-actions/create-notification-rule, so external AI tools (Claude Code, Cursor) can call it over MCP, or over the Abilities REST route with a scoped API token.
/ Plan step shape
{ "ability": "create_notification_rule", "input": { "event": …, "channel_ids": […], "webhook_id": …, "filters": {…}, "template": {…} } }
/ Scope & confirmation
Minimum API-token scope for external (MCP/REST) callers: full. Runs without a confirmation pause (the overall plan is still user-approved before execution starts). The result includes a rendered preview of the message so the plan review shows what will be sent.
/ Input fields
| Name | In | Type | Req | Description |
|---|---|---|---|---|
| event | param | string | yes | `success` | `recovered` | `failed_attempt` | `retry_scheduled` | `permanently_failed` | `skipped`. |
| channel_ids | param | integer[] | yes | From `list_notification_channels`. |
| webhook_id | param | integer | — | Scope to one webhook; omit for site-wide. |
| name | param | string | — | |
| filters | param | object | — | `attempts`, `http_codes`, `reason`, `triggers`, `only_after_retry`, `include_tests`. |
| template | param | object | — | `subject`, `title`, `body`, `short` — linted against the captured payload. |
| throttle_seconds | param | integer | — | At most one message per webhook in this window. |
| digest | param | string | — | `hourly` | `daily`. |
| is_enabled | param | boolean | — | Default true. |
/ Examples
Plan step as Build with AI proposes it
{ "id": "step_4", "ability": "create_notification_rule", "summary": "Post to #ops-alerts when the HubSpot sync gives up", "input": { "webhook_id": "{{step_1.id}}", "event": "permanently_failed", "channel_ids": [3], "template": { "body": "Order {{ payload.order.id }} did not reach HubSpot: {{ delivery.error_message | truncate:120 }}" } } }
/ Related