{
  "workflow_name": "Run a win-back play the moment an order is refunded",
  "workflow_steps": {
    "steps": [
      {
        "id": "1",
        "position": {
          "x": 0,
          "y": 0
        },
        "data": {
          "label": "Order Updated",
          "app": {
            "key": "woocommerce",
            "fm_app": "woocommerce"
          },
          "eventSlug": "update_order",
          "eventTitle": "Order Updated",
          "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",
        "stepID": "1",
        "action": "update_order",
        "nodeType": "step",
        "actionAppArgs": [],
        "captureResponse": {
          "order_id": "10432",
          "order_number": "10432",
          "billing_first_name": "Priya",
          "billing_last_name": "Nair",
          "billing_email": "priya@example.com",
          "billing_phone": "+15557654321",
          "total": "349.00",
          "currency": "USD",
          "payment_method": "Credit Card",
          "status": "processing",
          "items_count": "3"
        },
        "responses": [
          {
            "letter": "A",
            "time": "01/07/2026, 10:00:00",
            "response": {
              "order_id": "10432",
              "order_number": "10432",
              "billing_first_name": "Priya",
              "billing_last_name": "Nair",
              "billing_email": "priya@example.com",
              "billing_phone": "+15557654321",
              "total": "349.00",
              "currency": "USD",
              "payment_method": "Credit Card",
              "status": "processing",
              "items_count": "3"
            }
          }
        ],
        "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": "You are a retention specialist. Write a warm win-back email with a modest incentive, send it, and tag the customer into the win-back sequence.",
          "user_input": "Customer: {woocommerce1.billing_first_name} {woocommerce1.billing_last_name}\nEmail: {woocommerce1.billing_email}\nOrder: {woocommerce1.order_number}",
          "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 the win-back offer",
              "actionAppArgs": {
                "to_email": "{woocommerce1.billing_email}",
                "email_subject": "AI:",
                "email_body": "AI:"
              },
              "configured": true,
              "sourceNodeId": "2-tool"
            },
            {
              "app": "fluentcrm",
              "app_name": "FluentCRM",
              "app_icon": "",
              "action": "add_contact_to_tags",
              "action_title": "Add Tags to Contact",
              "tool_name": "FluentCRM - Add Tags to Contact",
              "tool_description": "Tag for win-back",
              "actionAppArgs": {
                "contact_email": "{woocommerce1.billing_email}",
                "tags": "AI:"
              },
              "configured": true,
              "sourceNodeId": "2-tool"
            }
          ]
        }
      },
      {
        "id": "3",
        "position": {
          "x": 350,
          "y": 0
        },
        "type": "action",
        "data": {
          "label": "Log win-back",
          "layoutDirection": "horizontal",
          "stepNumber": 3,
          "app": {
            "key": "fluentcrm",
            "fm_app": "fluentcrm"
          },
          "eventSlug": "add_note_to_contact",
          "eventTitle": "Add Note to Contact"
        },
        "parentType": "step",
        "style": {
          "transition": "all 150ms ease-in-out"
        },
        "measured": {
          "width": 82,
          "height": 82
        },
        "actionAppArgs": {
          "contact_email": "{woocommerce1.billing_email}",
          "note_title": "Win-back triggered",
          "note_content": "Refund on order {woocommerce1.order_number} started a win-back play."
        },
        "application": "fluentcrm",
        "action": "add_note_to_contact",
        "nodeType": "step",
        "stepID": "3"
      },
      {
        "id": "main_end_placeholder",
        "position": {
          "x": 525,
          "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-main_end_placeholder",
        "source": "3",
        "target": "main_end_placeholder",
        "type": "placeholder",
        "data": []
      }
    ]
  },
  "workflow_settings": {
    "name": "Run a win-back play the moment an order is refunded",
    "folder": "all",
    "description": "When an order is updated to refunded, an AI agent crafts a personalized win-back offer email, tags the customer for a win-back sequence, and logs the outreach.",
    "status": "off",
    "user_email": "",
    "webhook_queue": "disabled",
    "workflow_auth_key": "",
    "builder_version": "v2",
    "time": "",
    "ai_generated": "yes"
  }
}