WP Webhooks / Docs / preview_snippet
AI Ability Pro since v1.3.0

preview_snippet

Preview (test-run) a Code Glue snippet — Test-run a snippet (by snippet_id, or raw code) against a real captured payload WITHOUT dispatching anything.

$

Test-run a snippet (by snippet_id, or raw code) against a real captured payload WITHOUT dispatching anything. Pass webhook_id+trigger to use the captured example payload, or provide an explicit payload. Returns the transformed payload, any PHP error and printed output. Always preview before assigning. Registered as the WordPress Ability flowsystems-webhook-actions/preview_snippet, so external AI tools (Claude Code, Cursor) can call it over MCP or REST with a scoped API token.

/ Plan step shape

{ "ability": "preview_snippet", "input": { "snippet_id":, "code":, "webhook_id":, "trigger":, "payload":, "mode":} }

/ 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).

/ Input fields

NameInTypeReqDescription
snippet_idparamintegerSaved snippet to run; omit when passing code.
codeparamstringRaw PHP to run instead of a saved snippet.
webhook_idparamintegerWith trigger: use this webhook's captured example payload.
triggerparamstring
payloadparamobjectExplicit test payload; overrides the captured example.
modeparamstring pre | post

/ Examples

Plan step as the AI Builder proposes it

{
  "id": "step_1",
  "ability": "preview_snippet",
  "summary": "…",
  "input": {
    "snippet_id": 4,
    "webhook_id": 12,
    "trigger": "woocommerce_order_status_completed"
  }
}

/ Related

Ready

Your next automation is
one sentence away.

$ wp plugin install flowsystems-webhook-actions --activate