{
  "id": "V7STQO77bH6lSXlr",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Customer 360 AI Intelligence Workflow",
  "tags": [],
  "nodes": [
    {
      "id": "6183da99-0f28-46ec-beda-e76b0fb31cc2",
      "name": "Batch Sync",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        144
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes",
              "minutesInterval": 1
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "ed3cd713-35f2-41b0-8cd0-2520ac36e92a",
      "name": "Marketing - Fetch Engagement",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2016,
        -128
      ],
      "parameters": {
        "url": "=https://dummyjson.com/posts?limit=2&customer={{$json[\"Id\"]}}",
        "options": {}
      },
      "typeVersion": 4.4
    },
    {
      "id": "9227985e-a8d3-4f28-bad0-950fc612c361",
      "name": "ERP - Fetch Orders",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1120,
        48
      ],
      "parameters": {
        "url": "=https://dummyjson.com/products?limit=2&customer={{$json[\"Id\"]}}",
        "options": {}
      },
      "typeVersion": 4.4
    },
    {
      "id": "1bf27bd6-4cf5-42c7-98a9-7cdf95f226db",
      "name": "ERP - Fetch Payments",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1568,
        -128
      ],
      "parameters": {
        "url": "=https://dummyjson.com/carts?limit=2&customer={{$json[\"Id\"]}}",
        "options": {}
      },
      "typeVersion": 4.4
    },
    {
      "id": "a287734a-8a34-4b5e-9801-4590f842e4aa",
      "name": "Support - Fetch Tickets",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1792,
        -128
      ],
      "parameters": {
        "url": "=https://dummyjson.com/comments?limit=2&customer={{$json[\"Id\"]}}",
        "options": {}
      },
      "typeVersion": 4.4
    },
    {
      "id": "3454396d-0d94-4aca-9200-2e207201444e",
      "name": "Normalize - Customer Data",
      "type": "n8n-nodes-base.set",
      "position": [
        2240,
        -128
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "39f01023-0449-4e6c-861f-457549c79e59",
              "name": "customer_id",
              "type": "string",
              "value": "={{$node[\"Salesforce - Fetch Accounts\"].json[\"Id\"]}}"
            },
            {
              "id": "43615831-f7c3-44e7-83e4-78627634f97c",
              "name": "customer_name",
              "type": "string",
              "value": "={{$node[\"Salesforce - Fetch Accounts\"].json[\"Name\"]}}"
            },
            {
              "id": "9a91961e-2146-4081-b2d1-0e20dd3b5a00",
              "name": "orders_data",
              "type": "object",
              "value": "={{ JSON.parse($node[\"ERP - Fetch Orders\"].json[\"products\"] ? JSON.stringify($node[\"ERP - Fetch Orders\"].json) : $node[\"ERP - Fetch Orders\"].json) }}"
            },
            {
              "id": "06d1ca2c-3413-450b-b0ec-97d6061e72e5",
              "name": "payments_data",
              "type": "object",
              "value": "={{$node[\"ERP - Fetch Payments\"].json}}"
            },
            {
              "id": "23646e42-4cf3-49af-96c8-818b50ead170",
              "name": "tickets_data",
              "type": "object",
              "value": "={{$node[\"Support - Fetch Tickets\"].json}}"
            },
            {
              "id": "5f03ebcd-38fd-4800-a3ed-08e3874d4438",
              "name": "marketing_data",
              "type": "object",
              "value": "={{$node[\"Marketing - Fetch Engagement\"].json}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "d39f4f26-17c0-4998-9b0d-f92d6de16ff2",
      "name": "Salesforce - Fetch Accounts",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        224,
        144
      ],
      "parameters": {
        "limit": 5,
        "options": {},
        "resource": "account",
        "operation": "getAll"
      },
      "credentials": {
        "salesforceOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f5ba2b5c-5586-4218-90ab-a2d21ed7108b",
      "name": "Prepare AI Input",
      "type": "n8n-nodes-base.code",
      "position": [
        2464,
        -128
      ],
      "parameters": {
        "jsCode": "// Get current item\nconst item = $json;\n\nreturn [\n  {\n    json: {\n      ai_input: {\n        customer_name: item.customer_name,\n        customer_id: item.customer_id,\n        orders: item.orders_data,\n        payments: item.payments_data,\n        tickets: item.tickets_data,\n        engagement: item.marketing_data\n      }\n    }\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "8848bd80-d4ce-4dbd-b434-2167f0f7033a",
      "name": "Parse - AI Output",
      "type": "n8n-nodes-base.code",
      "position": [
        3040,
        -128
      ],
      "parameters": {
        "jsCode": "let text = \"\";\n\ntry {\n  text = $input.first().json.content.parts[0].text\n} catch (e) {\n  text = \"\";\n}\n\n// Clean if needed\ntext = text.replace(/```json/g, \"\").replace(/```/g, \"\").trim();\n\nlet parsed = {};\n\ntry {\n  parsed = JSON.parse(text);\n} catch (e) {\n  parsed = {};\n}\n\nreturn [{\n  json: {\n    customer_id: $('Prepare AI Input').first().json.ai_input.customer_id,\n    customer_name:$('Prepare AI Input').first().json.ai_input.customer_name ,\n    health_score: parsed.health_score || 50,\n    churn_risk: parsed.churn_risk || \"Medium\",\n    customer_type: parsed.customer_type || \"Regular\",\n    summary: parsed.summary || \"No summary\",\n    action: parsed.action || \"No action\"\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "434b33d8-77c9-4786-8315-3fb97152e44a",
      "name": "Decision - High Risk",
      "type": "n8n-nodes-base.if",
      "position": [
        3264,
        -128
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e228e5ef-5bc5-4194-8dbc-9e477660fd80",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{$json[\"churn_risk\"]}}",
              "rightValue": "=HIGH"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "4174ce9f-2108-4e74-b22f-6b419f72d495",
      "name": "Routing - Customer Type",
      "type": "n8n-nodes-base.switch",
      "position": [
        3488,
        -32
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "ff86d45d-7db4-4dc4-9587-bc7484d399bc",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.customer_type }}",
                    "rightValue": "VIP"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "5e7f55aa-95ae-427b-82ec-e147684aa4e3",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.customer_type }}",
                    "rightValue": "Regular"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "bb3c1ca5-dfe9-4833-8f93-b2d6dfd503a5",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.customer_type }}",
                    "rightValue": "At Risk"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.4
    },
    {
      "id": "c4c9b49e-0909-4b70-88e3-4035d6fe1187",
      "name": "Update an account",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        3936,
        -96
      ],
      "parameters": {
        "resource": "account",
        "accountId": "={{ $json.customer_id }}",
        "operation": "update",
        "updateFields": {
          "description": "={{ $json.summary }}"
        }
      },
      "credentials": {
        "salesforceOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ae3158be-d2db-477c-bce0-6cce305581be",
      "name": "Alert - High Risk Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        3488,
        -224
      ],
      "parameters": {
        "sendTo": "",
        "message": "=Customer Name: {{$json.customer_name}}  Risk Level: {{$json.churn_risk}} Health Score: {{$json.health_score}}  Summary: {{$json.summary}}  Recommended Action: {{$json.action}}",
        "options": {},
        "subject": "High Risk Customer Alert"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "911ad0e1-1e70-41e7-9c3b-e3f63964a03e",
      "name": "Error Trigger",
      "type": "n8n-nodes-base.errorTrigger",
      "position": [
        -48,
        864
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "2285fd5e-5d6b-4fd0-903f-ae360008de53",
      "name": "Wait - Retry Delay",
      "type": "n8n-nodes-base.wait",
      "position": [
        1568,
        80
      ],
      "parameters": {
        "amount": 3
      },
      "typeVersion": 1.1
    },
    {
      "id": "7fd09f69-c06b-49ba-8525-439b12c323f4",
      "name": "Init Retry Code",
      "type": "n8n-nodes-base.code",
      "position": [
        672,
        144
      ],
      "parameters": {
        "jsCode": "let retry = $json.retry_count || 0;\n\nreturn [{\n  json: {\n    ...$json,\n    retry_count: retry\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "5c994b4b-bc39-4600-b481-b9fe19a279eb",
      "name": "Fallback - Fetch Orders Backup",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1120,
        368
      ],
      "parameters": {
        "url": "https://dummyjson.com/carts",
        "options": {}
      },
      "typeVersion": 4.4
    },
    {
      "id": "5f2e4b77-3caf-4cb0-9719-5343d0fbf1f2",
      "name": "Log - Execution Summary",
      "type": "n8n-nodes-base.code",
      "position": [
        4384,
        -16
      ],
      "parameters": {
        "jsCode": "return [{\n  json: {\n    customer: $json.customer_name,\n    score: $json.health_score,\n    risk: $json.churn_risk,\n    time: new Date().toISOString(),\n    status: \"Processed\"\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "a79bbb32-9147-4f75-926a-277715e78b29",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        448,
        144
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "b9c20a9e-956c-4974-b89b-b54cfcb9c89c",
      "name": "Increment Retry Count",
      "type": "n8n-nodes-base.code",
      "position": [
        1792,
        144
      ],
      "parameters": {
        "jsCode": "let retry = $json.retry_count || 0;\n\nreturn [{\n  json: {\n    ...$json,\n    retry_count: retry + 1\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "c6ff6ef8-81ae-41f5-914f-0d9f6a378043",
      "name": "Merge - Final Output",
      "type": "n8n-nodes-base.merge",
      "position": [
        4160,
        -16
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "38e28c59-ada5-410f-91dc-5cb141eb4228",
      "name": "Merge - Preserve Data",
      "type": "n8n-nodes-base.merge",
      "position": [
        3712,
        -48
      ],
      "parameters": {
        "numberInputs": 4
      },
      "typeVersion": 3.2
    },
    {
      "id": "44518c3b-5e3a-46d7-885c-18b4e8779900",
      "name": "Alert - Error Notification",
      "type": "n8n-nodes-base.gmail",
      "position": [
        256,
        864
      ],
      "parameters": {
        "sendTo": "",
        "message": "=Node: {{$json.execution.lastNodeExecuted}}\nError: {{$json.execution.error.message}}\nExecution ID: {{$json.execution.id}}\nWorkflow: {{$json.workflow.name}}\nExecution URL: {{$json.execution.url}}",
        "options": {},
        "subject": "Workflow Failed"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "54dcfbfd-73d8-47eb-a810-6f6e881aeb22",
      "name": "AI - Customer Intelligence (Gemini)",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        2688,
        -128
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-3.1-flash-lite-preview",
          "cachedResultName": "models/gemini-3.1-flash-lite-preview"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=You are an advanced Customer Intelligence AI system.\n\nAnalyze the following customer data carefully and generate structured business insights.\n\nCustomer Data:\n{{ JSON.stringify($json.ai_input, null, 2) }}\n\nSTRICT INSTRUCTIONS:\n- Always assume data is valid\n- Do NOT say \"no data\"\n- Do NOT return errors\n- Do NOT include markdown or ```json\n- Return ONLY clean JSON (no extra text)\n- Ensure all fields are present\n- If any field is missing, infer reasonable values\n\nANALYSIS REQUIREMENTS:\n- Evaluate customer engagement, purchase behavior, and satisfaction\n- Detect churn risk signals (low engagement, negative feedback, low orders)\n- Identify customer value level (VIP, Regular, At Risk)\n- Provide actionable business recommendations\n\nReturn ONLY this JSON format:\n\n{\n  \"health_score\": number (0-100),\n  \"churn_risk\": \"Low\" | \"Medium\" | \"High\",\n  \"customer_type\": \"VIP\" | \"Regular\" | \"At Risk\",\n  \"summary\": \"concise but insightful business summary\",\n  \"action\": \"clear recommended next step for business\"\n}"
            }
          ]
        },
        "builtInTools": {}
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "b1eb0b01-341e-4dba-a682-88646c49cba3",
      "name": "Decision - Orders Success",
      "type": "n8n-nodes-base.if",
      "position": [
        1344,
        -32
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "f84b5212-26e2-48c1-874f-28cfa5643dbb",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{$json[\"products\"].length}}",
              "rightValue": 0
            },
            {
              "id": "11fbf28c-8929-4063-83b3-c62c816613d1",
              "operator": {
                "type": "number",
                "operation": "lt"
              },
              "leftValue": "={{$json[\"retry_count\"] || 0}}",
              "rightValue": 3
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "515961fe-6de3-41b6-994a-42fdeb0a85e3",
      "name": "Decision - Circuit Breaker",
      "type": "n8n-nodes-base.if",
      "position": [
        896,
        144
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "27a47dff-4a79-4ab9-81f1-92c17a64802e",
              "operator": {
                "type": "number",
                "operation": "lt"
              },
              "leftValue": "={{$json[\"retry_count\"] || 0}}",
              "rightValue": 3
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "ba7b4e1b-4944-4fbd-9626-857258ff0d64",
      "name": "Alert - Success Notification",
      "type": "n8n-nodes-base.gmail",
      "position": [
        4608,
        -16
      ],
      "parameters": {
        "sendTo": "",
        "message": "=Customer: {{$json.customer}}  Score: {{$json.score}} Risk: {{$json.risk}}  Status: {{$json.status}} Time: {{$json.time}}",
        "options": {},
        "subject": "Customer Processed Successfully"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "315c6aff-16df-4ece-835b-6381bd0bd495",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -720,
        -512
      ],
      "parameters": {
        "width": 624,
        "height": 528,
        "content": "## Customer 360 AI Intelligence Workflow\nThis workflow automates the creation of a unified customer profile by integrating Salesforce data with ERP, payments, support, and marketing systems, and transforming it into actionable insights using AI.\n\n### How it works:\n\nThe system fetches customer records from Salesforce and processes them in batches. It enriches each customer with data from multiple APIs, using retry logic, circuit breaker, and fallback mechanisms for reliability. The aggregated data is analyzed by an AI model (Gemini) to generate structured insights such as health score, churn risk, and recommended actions. Based on these insights, the workflow updates Salesforce and triggers alerts for high-risk customers while maintaining execution logs.\n\n### Setup steps:\n\nConfigure Salesforce and external API credentials\nSet up batch trigger and looping mechanism\nImplement retry, circuit breaker, and fallback logic\nConfigure Gemini API and structured AI prompt\nConnect decision nodes, alerts, and Salesforce update"
      },
      "typeVersion": 1
    },
    {
      "id": "979f0a9f-b292-447c-ad23-3bcfa10175fb",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        16
      ],
      "parameters": {
        "color": 7,
        "width": 656,
        "height": 320,
        "content": "## Data Ingestion\nFetch customer data from Salesforce and process it in batches using loop control for scalable execution."
      },
      "typeVersion": 1
    },
    {
      "id": "878eff0b-7a47-41c5-be92-e56894f82ecf",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        -352
      ],
      "parameters": {
        "color": 7,
        "width": 1552,
        "height": 928,
        "content": "## Fault Tolerance & Data Fetch\nEnsures reliable data retrieval using retry logic, circuit breaker, and fallback API across all external systems."
      },
      "typeVersion": 1
    },
    {
      "id": "adb3164b-b358-4a8f-83ba-3eaf19ea4195",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2192,
        -368
      ],
      "parameters": {
        "color": 7,
        "width": 2640,
        "height": 592,
        "content": "## AI & Automation\nProcesses data, generates AI insights, and triggers decisions, alerts, and Salesforce updates."
      },
      "typeVersion": 1
    },
    {
      "id": "2d05c6d7-539f-471c-bd55-a6170122515f",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -112,
        720
      ],
      "parameters": {
        "color": 7,
        "width": 608,
        "height": 320,
        "content": "## Error Notification \nIf any node in the whole workflow fails to execute or has some error it will send the an email to the user."
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "08e3a212-2291-4ec9-a178-59630a0b71d1",
  "connections": {
    "Batch Sync": {
      "main": [
        [
          {
            "node": "Salesforce - Fetch Accounts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Error Trigger": {
      "main": [
        [
          {
            "node": "Alert - Error Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Init Retry Code": {
      "main": [
        [
          {
            "node": "Decision - Circuit Breaker",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Init Retry Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare AI Input": {
      "main": [
        [
          {
            "node": "AI - Customer Intelligence (Gemini)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse - AI Output": {
      "main": [
        [
          {
            "node": "Decision - High Risk",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update an account": {
      "main": [
        [
          {
            "node": "Merge - Final Output",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "ERP - Fetch Orders": {
      "main": [
        [
          {
            "node": "Decision - Orders Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait - Retry Delay": {
      "main": [
        [
          {
            "node": "Increment Retry Count",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Decision - High Risk": {
      "main": [
        [
          {
            "node": "Alert - High Risk Email",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Routing - Customer Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ERP - Fetch Payments": {
      "main": [
        [
          {
            "node": "Support - Fetch Tickets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge - Final Output": {
      "main": [
        [
          {
            "node": "Log - Execution Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Increment Retry Count": {
      "main": [
        [
          {
            "node": "ERP - Fetch Orders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge - Preserve Data": {
      "main": [
        [
          {
            "node": "Update an account",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge - Final Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log - Execution Summary": {
      "main": [
        [
          {
            "node": "Alert - Success Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Routing - Customer Type": {
      "main": [
        [
          {
            "node": "Merge - Preserve Data",
            "type": "main",
            "index": 1
          }
        ],
        [
          {
            "node": "Merge - Preserve Data",
            "type": "main",
            "index": 2
          }
        ],
        [
          {
            "node": "Merge - Preserve Data",
            "type": "main",
            "index": 3
          }
        ]
      ]
    },
    "Support - Fetch Tickets": {
      "main": [
        [
          {
            "node": "Marketing - Fetch Engagement",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Decision - Orders Success": {
      "main": [
        [
          {
            "node": "ERP - Fetch Payments",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait - Retry Delay",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize - Customer Data": {
      "main": [
        [
          {
            "node": "Prepare AI Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Decision - Circuit Breaker": {
      "main": [
        [
          {
            "node": "ERP - Fetch Orders",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Fallback - Fetch Orders Backup",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Salesforce - Fetch Accounts": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Marketing - Fetch Engagement": {
      "main": [
        [
          {
            "node": "Normalize - Customer Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fallback - Fetch Orders Backup": {
      "main": [
        [
          {
            "node": "Decision - Orders Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI - Customer Intelligence (Gemini)": {
      "main": [
        [
          {
            "node": "Parse - AI Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}