assign_snippet
Assign a Code Glue snippet to a webhook — Attach a snippet to a webhook+trigger as its pre-dispatch (payload transform) or post-dispatch (after-response side effects) Code Glue and enable it.
Attach a snippet to a webhook+trigger as its pre-dispatch (payload transform) or post-dispatch (after-response side effects) Code Glue and enable it. Requires confirmation — the snippet's PHP runs on every real dispatch from then on. Pass snippet_id 0 to unassign, or enabled false to keep it assigned but paused. Registered as the WordPress Ability flowsystems-webhook-actions/assign_snippet, so external AI tools (Claude Code, Cursor) can call it over MCP or REST with a scoped API token.
/ Plan step shape
{ "ability": "assign_snippet", "input": { "webhook_id": …, "trigger": …, "stage": …, "snippet_id": …, "enabled": … } }
/ Scope & confirmation
Minimum API-token scope for external (MCP/REST) callers: full. This step always pauses for explicit user confirmation before it runs.
/ Input fields
| Name | In | Type | Req | Description |
|---|---|---|---|---|
| webhook_id | param | integer | yes | |
| trigger | param | string | yes | |
| stage | param | string | yes | pre = transform payload before dispatch; post = run after the response. pre | post |
| snippet_id | param | integer | yes | 0 to unassign. |
| enabled | param | boolean | — |
/ Examples
Plan step as the AI Builder proposes it
{ "id": "step_1", "ability": "assign_snippet", "summary": "…", "input": { "webhook_id": 12, "trigger": "woocommerce_order_status_completed", "stage": "pre", "snippet_id": 4, "enabled": true } }
/ Related