{
  "workflow_name": "AI agent that runs a save-play when a subscription is cancelled",
  "workflow_steps": {
    "steps": [
      {
        "id": "1",
        "position": {
          "x": 0,
          "y": 0
        },
        "data": {
          "label": "Subscription Cancelled",
          "app": {
            "key": "woocommerce_subscriptions",
            "fm_app": "woocommerce_subscriptions"
          },
          "eventSlug": "subscription_cancelled",
          "eventTitle": "Subscription Cancelled",
          "layoutDirection": "horizontal",
          "stepNumber": 1
        },
        "targetPosition": "bottom",
        "type": "trigger",
        "stepNumber": 1,
        "expanded": true,
        "style": {
          "transition": "all 150ms ease-in-out"
        },
        "measured": {
          "width": 82,
          "height": 82
        },
        "application": "woocommerce_subscriptions",
        "stepID": "1",
        "action": "subscription_cancelled",
        "nodeType": "step",
        "actionAppArgs": [],
        "captureResponse": {
          "subscription_id": "900",
          "billing_email": "priya@example.com",
          "billing_first_name": "Priya",
          "total": "29.00",
          "reason": "too expensive"
        },
        "responses": [
          {
            "letter": "A",
            "time": "01/07/2026, 10:00:00",
            "response": {
              "subscription_id": "900",
              "billing_email": "priya@example.com",
              "billing_first_name": "Priya",
              "total": "29.00",
              "reason": "too expensive"
            }
          }
        ],
        "activeResponseIndex": 0
      },
      {
        "id": "2",
        "position": {
          "x": 175,
          "y": 0
        },
        "type": "action",
        "data": {
          "label": "AI Agent by FlowMattic",
          "layoutDirection": "horizontal",
          "stepNumber": 2,
          "stepIndex": 2,
          "app": {
            "key": "ai_agent",
            "fm_app": "ai_agent"
          },
          "eventSlug": "execute_agent",
          "eventTitle": "Execute Agent"
        },
        "parentType": "step",
        "style": {
          "transition": "all 150ms ease-in-out"
        },
        "measured": {
          "width": 350,
          "height": 82
        },
        "actionAppArgs": {
          "system_prompt": "A customer just cancelled. Draft a warm win-back email addressing their reason, log a CRM note, and alert the retention team.",
          "user_input": "Customer {woocommerce_subscriptions1.billing_first_name} cancelled. Reason: {woocommerce_subscriptions1.reason}.",
          "output_format": "text",
          "application": "ai_agent",
          "responseViewType": "on",
          "include_execution_log": "",
          "include_request_body": ""
        },
        "application": "ai_agent",
        "stepID": "2",
        "nodeType": "aiAgent",
        "agent_config": {
          "chat_model": {
            "connect_id": "",
            "model_id": "gpt-4o",
            "model_name": "GPT-4o",
            "provider": "openai",
            "max_tokens": "1024",
            "temperature": "0.7",
            "top_p": "1",
            "top_k": "0",
            "frequency_penalty": "0",
            "presence_penalty": "0",
            "nodeId": "2-chatModel",
            "position": {
              "x": 215,
              "y": 172
            }
          },
          "tools": [
            {
              "app": "email",
              "app_name": "Email by FlowMattic",
              "app_icon": "",
              "action": "send_email",
              "action_title": "Send Email",
              "tool_name": "Email by FlowMattic - Send Email",
              "tool_description": "Send a win-back email",
              "actionAppArgs": {
                "to_email": "{woocommerce_subscriptions1.billing_email}",
                "email_subject": "AI:",
                "email_body": "AI:"
              },
              "configured": true,
              "sourceNodeId": "2-tool"
            },
            {
              "app": "fluentcrm",
              "app_name": "FluentCRM",
              "app_icon": "",
              "action": "add_note_to_contact",
              "action_title": "Add Note to Contact",
              "tool_name": "FluentCRM - Add Note to Contact",
              "tool_description": "Log the save attempt",
              "actionAppArgs": {
                "contact_email": "{woocommerce_subscriptions1.billing_email}",
                "note_title": "AI:",
                "note_content": "AI:"
              },
              "configured": true,
              "sourceNodeId": "2-tool"
            },
            {
              "app": "slack",
              "app_name": "Slack",
              "app_icon": "",
              "action": "send_message_to_channel",
              "action_title": "Send Channel Message",
              "tool_name": "Slack - Send Channel Message",
              "tool_description": "Alert retention",
              "actionAppArgs": {
                "message_text": "AI:"
              },
              "configured": true,
              "sourceNodeId": "2-tool"
            }
          ]
        }
      },
      {
        "id": "3",
        "position": {
          "x": 350,
          "y": 0
        },
        "type": "action",
        "data": {
          "label": "Delay",
          "layoutDirection": "horizontal",
          "stepNumber": 3,
          "app": {
            "key": "delay",
            "fm_app": "delay"
          },
          "eventSlug": "delay_for",
          "eventTitle": "Delay For"
        },
        "parentType": "step",
        "style": {
          "transition": "all 150ms ease-in-out"
        },
        "measured": {
          "width": 82,
          "height": 82
        },
        "actionAppArgs": {
          "delayUnit": "days",
          "delayValue": "3"
        },
        "application": "delay",
        "action": "delay_for",
        "nodeType": "step",
        "stepID": "3"
      },
      {
        "id": "4",
        "position": {
          "x": 525,
          "y": 0
        },
        "type": "action",
        "data": {
          "label": "Send Email",
          "layoutDirection": "horizontal",
          "stepNumber": 4,
          "app": {
            "key": "email",
            "fm_app": "email"
          },
          "eventSlug": "send_email",
          "eventTitle": "Send Email"
        },
        "parentType": "step",
        "style": {
          "transition": "all 150ms ease-in-out"
        },
        "measured": {
          "width": 82,
          "height": 82
        },
        "actionAppArgs": {
          "to_email": "{woocommerce_subscriptions1.billing_email}",
          "email_subject": "We'd love you back",
          "email_body": "Here's a special offer if you'd like to reactivate."
        },
        "application": "email",
        "action": "send_email",
        "nodeType": "step",
        "stepID": "4"
      },
      {
        "id": "main_end_placeholder",
        "position": {
          "x": 700,
          "y": 0
        },
        "type": "placeholder",
        "data": {
          "label": "+",
          "layoutDirection": "horizontal",
          "stepNumber": null,
          "app": []
        },
        "measured": {
          "width": 40,
          "height": 82
        },
        "stepID": "main_end_placeholder",
        "nodeType": "placeholder",
        "actionAppArgs": []
      }
    ],
    "edges": [
      {
        "id": "e-1-2",
        "source": "1",
        "target": "2",
        "type": "step",
        "data": []
      },
      {
        "id": "e-2-3",
        "source": "2",
        "target": "3",
        "type": "step",
        "data": []
      },
      {
        "id": "e-3-4",
        "source": "3",
        "target": "4",
        "type": "step",
        "data": []
      },
      {
        "id": "e-4-main_end_placeholder",
        "source": "4",
        "target": "main_end_placeholder",
        "type": "placeholder",
        "data": []
      }
    ]
  },
  "workflow_settings": {
    "name": "AI agent that runs a save-play when a subscription is cancelled",
    "folder": "all",
    "description": "When a subscription is cancelled, an AI agent drafts a personalised win-back email, adds a CRM note, and alerts the retention team so a human can follow up fast.",
    "status": "off",
    "user_email": "",
    "webhook_queue": "disabled",
    "workflow_auth_key": "",
    "builder_version": "v2",
    "time": "",
    "ai_generated": "yes"
  }
}