{
  "id": "ciVBeFePMcsrlZuz",
  "name": "GPT5-Pro-Powered Smart Customer Journey Routing and Real-Time Data Sync",
  "tags": [],
  "nodes": [
    {
      "id": "05710537-e9b1-4ae2-92fa-873377987ea5",
      "name": "Touchpoint Event Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -448,
        432
      ],
      "parameters": {
        "path": "customer-touchpoint",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2.1
    },
    {
      "id": "8cd9b6e5-1fee-4fbd-8d53-814c6b98a6bf",
      "name": "Journey Optimization Schedule",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -224,
        1008
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours"
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "b32650f1-a332-4d33-be83-a03b0eb53a5f",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        -224,
        432
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "crmApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__CRM API endpoint URL__>"
            },
            {
              "id": "id-2",
              "name": "emailApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Email history API endpoint__>"
            },
            {
              "id": "id-3",
              "name": "chatApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Chat history API endpoint__>"
            },
            {
              "id": "id-4",
              "name": "purchaseApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Purchase history API endpoint__>"
            },
            {
              "id": "id-5",
              "name": "metricsApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Metrics logging API endpoint__>"
            },
            {
              "id": "id-6",
              "name": "performanceApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Performance data API endpoint__>"
            },
            {
              "id": "id-7",
              "name": "databaseApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Customer database API endpoint__>"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "a7d480a9-5940-4a52-a049-326d364331bd",
      "name": "Fetch CRM Data",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        0,
        176
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.crmApiUrl }}/customer/{{ $json.customerId }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "a130441b-5c38-4392-b069-77336febd125",
      "name": "Fetch Email History",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        0,
        352
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.emailApiUrl }}/customer/{{ $json.customerId }}/emails",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "952b2baa-ee02-4fe4-8d2a-c89fe19c4c19",
      "name": "Fetch Chat History",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        0,
        480
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.chatApiUrl }}/customer/{{ $json.customerId }}/chats",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "2a5d39d0-b61b-4ac6-a902-eb855ae070c9",
      "name": "Fetch Purchase History",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        0,
        672
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.purchaseApiUrl }}/customer/{{ $json.customerId }}/purchases",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "c967137b-53be-4c02-90fa-d23814f8222b",
      "name": "Merge Customer Data",
      "type": "n8n-nodes-base.merge",
      "position": [
        224,
        240
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineAll"
      },
      "typeVersion": 3.2
    },
    {
      "id": "58e77bf8-a49c-4ac7-80a2-e550e61b187e",
      "name": "Customer State Builder AI",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        448,
        240
      ],
      "parameters": {
        "text": "={{ $json }}",
        "options": {
          "systemMessage": "You are a customer journey state analyzer. Your task is to analyze all customer touchpoint data and build a comprehensive real-time customer state.\n\nAnalyze the following data sources:\n- CRM data (demographics, account info, preferences)\n- Email interaction history (opens, clicks, responses)\n- Chat conversation history (topics, sentiment, issues)\n- Purchase history (products, frequency, value)\n- Current touchpoint event\n\nReturn a structured customer state that includes:\n- Customer segment (new, active, at-risk, churned, high-value)\n- Engagement level (high, medium, low)\n- Journey stage (awareness, consideration, purchase, retention, advocacy)\n- Next best actions (recommended touchpoints)\n- Predicted lifetime value\n- Risk score (churn probability)\n- Key interests and preferences"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "0d01641a-465b-4fdc-a76d-a854157274e6",
      "name": "OpenAI Model - State Builder",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        456,
        464
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "a0974f7b-09c8-4f27-8744-8412b1b285e7",
      "name": "Customer State Schema",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        584,
        464
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"customerId\": {\"type\": \"string\"},\n    \"segment\": {\"type\": \"string\", \"enum\": [\"new\", \"active\", \"at-risk\", \"churned\", \"high-value\"]},\n    \"engagementLevel\": {\"type\": \"string\", \"enum\": [\"high\", \"medium\", \"low\"]},\n    \"journeyStage\": {\"type\": \"string\", \"enum\": [\"awareness\", \"consideration\", \"purchase\", \"retention\", \"advocacy\"]},\n    \"nextBestActions\": {\"type\": \"array\", \"items\": {\"type\": \"string\"}},\n    \"predictedLifetimeValue\": {\"type\": \"number\"},\n    \"churnRiskScore\": {\"type\": \"number\", \"minimum\": 0, \"maximum\": 1},\n    \"interests\": {\"type\": \"array\", \"items\": {\"type\": \"string\"}}\n  },\n  \"required\": [\"customerId\", \"segment\", \"engagementLevel\", \"journeyStage\"]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "594b7231-7919-4edf-a302-9cd66c86c5aa",
      "name": "Journey Stage Router",
      "type": "n8n-nodes-base.switch",
      "position": [
        816,
        224
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Awareness",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.journeyStage }}",
                    "rightValue": "awareness"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Consideration",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.journeyStage }}",
                    "rightValue": "consideration"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Purchase",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.journeyStage }}",
                    "rightValue": "purchase"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Retention",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.journeyStage }}",
                    "rightValue": "retention"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Advocacy",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.journeyStage }}",
                    "rightValue": "advocacy"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.4
    },
    {
      "id": "9d6fb2da-4ca5-4919-84b5-95980d023083",
      "name": "Journey Optimizer AI",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1024,
        208
      ],
      "parameters": {
        "text": "={{ $json }}",
        "options": {
          "systemMessage": "You are a customer journey optimization AI. Your task is to analyze the customer state and determine the optimal multi-channel action sequence to maximize engagement and conversion.\n\nConsider:\n- Customer segment and engagement level\n- Journey stage and historical behavior\n- Channel preferences and response patterns\n- Time of day and frequency caps\n- A/B test variations for continuous optimization\n\nReturn optimized journey actions with:\n- Channel to use (email, sms, retargeting)\n- Message content and personalization\n- Timing and sequence\n- Success metrics to track\n- A/B test variant (if applicable)\n\nPrioritize actions that:\n1. Match customer preferences and behavior\n2. Respect frequency and timing constraints\n3. Test different approaches for learning\n4. Drive measurable business outcomes"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "ffe57740-8f16-4f18-b657-f9cac65a867a",
      "name": "OpenAI Model - Optimizer",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1032,
        416
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "571577c3-c6ec-4cd9-ab65-4bf47327f67a",
      "name": "Journey Action Schema",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1160,
        416
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"actionType\": {\"type\": \"string\", \"enum\": [\"email\", \"sms\", \"retargeting\"]},\n    \"recipientEmail\": {\"type\": \"string\"},\n    \"recipientPhone\": {\"type\": \"string\"},\n    \"subject\": {\"type\": \"string\"},\n    \"messageContent\": {\"type\": \"string\"},\n    \"timing\": {\"type\": \"string\"},\n    \"testVariant\": {\"type\": \"string\"},\n    \"metricsToTrack\": {\"type\": \"array\", \"items\": {\"type\": \"string\"}},\n    \"campaignId\": {\"type\": \"string\"}\n  },\n  \"required\": [\"actionType\", \"messageContent\", \"campaignId\"]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "8e1fa23f-f6c8-4d08-9f14-67a6f59c3bf8",
      "name": "Action Type Router",
      "type": "n8n-nodes-base.switch",
      "position": [
        1376,
        208
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Email",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.actionType }}",
                    "rightValue": "email"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "SMS",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.actionType }}",
                    "rightValue": "sms"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Retargeting",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.actionType }}",
                    "rightValue": "retargeting"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.4
    },
    {
      "id": "996af22c-b47d-4be2-a164-0503981854b5",
      "name": "Send Email Campaign",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1600,
        240
      ],
      "parameters": {
        "sendTo": "={{ $json.recipientEmail }}",
        "message": "={{ $json.messageContent }}",
        "options": {},
        "subject": "={{ $json.subject }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "b904a8c7-fccd-4800-ad1c-a3d92a06f2f6",
      "name": "Send SMS Campaign",
      "type": "n8n-nodes-base.twilio",
      "position": [
        1600,
        480
      ],
      "parameters": {
        "to": "={{ $json.recipientPhone }}",
        "from": "<__PLACEHOLDER_VALUE__Twilio phone number__>",
        "message": "={{ $json.messageContent }}",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "366a3584-1424-4df1-9e4d-f1611fe6dc3c",
      "name": "Create Retargeting Campaign",
      "type": "n8n-nodes-base.googleAds",
      "position": [
        1600,
        640
      ],
      "parameters": {
        "requestOptions": {},
        "clientCustomerId": "<__PLACEHOLDER_VALUE__Google Ads customer ID__>",
        "additionalOptions": {},
        "managerCustomerId": "<__PLACEHOLDER_VALUE__Google Ads customer ID__>"
      },
      "typeVersion": 1
    },
    {
      "id": "59498d35-edee-4c10-850d-662abb8bffd0",
      "name": "Log Performance Metrics",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1856,
        336
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.metricsApiUrl }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ { campaignId: $json.campaignId, actionType: $json.actionType, timestamp: new Date().toISOString(), customerId: $json.customerId, testVariant: $json.testVariant } }}",
        "sendBody": true,
        "specifyBody": "json"
      },
      "typeVersion": 4.3
    },
    {
      "id": "86954831-5514-4f4b-9202-2ee012665f1b",
      "name": "Fetch Performance Data",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        0,
        1008
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.performanceApiUrl }}/metrics?timeRange=24h",
        "options": {}
      },
      "typeVersion": 4.3
    },
    {
      "id": "a5941ca3-d2b2-4cb4-9c75-b6667815e77d",
      "name": "Aggregate Journey Results",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        224,
        1008
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "metrics"
      },
      "typeVersion": 1
    },
    {
      "id": "2bb4f651-c4e2-47e5-ae6f-afb6cc65ff0b",
      "name": "Update Customer State",
      "type": "n8n-nodes-base.set",
      "position": [
        512,
        1008
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "optimizationInsights",
              "type": "object",
              "value": "={{ $json.aggregatedMetrics }}"
            },
            {
              "id": "id-2",
              "name": "lastOptimized",
              "type": "string",
              "value": "={{ new Date().toISOString() }}"
            },
            {
              "id": "id-3",
              "name": "performanceTrends",
              "type": "object",
              "value": "={{ $json.trends }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "d305c853-e0d9-4d68-bd37-871637f588a2",
      "name": "Save Customer State to Database",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        832,
        1008
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.databaseApiUrl }}/customer-state",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ $json }}",
        "sendBody": true,
        "specifyBody": "json"
      },
      "typeVersion": 4.3
    },
    {
      "id": "1d719f37-1f58-4312-8652-6ab7fa93e462",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -496,
        -160
      ],
      "parameters": {
        "width": 880,
        "height": 192,
        "content": "## How It Works\nThis workflow automates personalized customer journeys by analyzing CRM data, purchase history, chat interactions, and performance metrics to intelligently route customer actions through multiple channels (email, SMS, retargeting) via AI-optimized schemas. A webhook trigger initiates the process by fetching CRM customer data, which is then merged with historical records and interactions. OpenAI builds comprehensive customer state profiles, enabling intelligent routing to appropriate channels using optimized journey logic. The system aggregates performance metrics in real-time and updates the database to maintain synchronized customer information across all systems. "
      },
      "typeVersion": 1
    },
    {
      "id": "1aeca93b-fd65-467d-9110-acc8da01d6c5",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        -160
      ],
      "parameters": {
        "color": 2,
        "width": 448,
        "height": 192,
        "content": "## Setup Steps\n1. Connect CRM credentials (source system)\n2. Add OpenAI API key for state builder\n3. Configure Gmail/SMS provider credentials\n4. Add Google Sheets connection for performance tracking\n5. Set Touchpoint Event Webhook URL\n6. Map database connection for customer state persistence"
      },
      "typeVersion": 1
    },
    {
      "id": "21a67f9e-bbe5-4e51-bf11-250e588ef3f5",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        864,
        -160
      ],
      "parameters": {
        "color": 3,
        "width": 304,
        "height": 128,
        "content": "## Prerequisites\nOpenAI API key, CRM access, Gmail/SMS provider accounts, Google Sheets, database (PostgreSQL/MySQL)"
      },
      "typeVersion": 1
    },
    {
      "id": "242280b5-8b4f-4070-82db-0b25007560a4",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1184,
        -160
      ],
      "parameters": {
        "color": 4,
        "height": 128,
        "content": "## Use Cases\nE-commerce personalization, SaaS customer retention, multi-touch marketing automation "
      },
      "typeVersion": 1
    },
    {
      "id": "e6479838-1491-4b0e-a094-68cee62f4682",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1440,
        -160
      ],
      "parameters": {
        "color": 5,
        "width": 288,
        "height": 128,
        "content": "## Customization\nModify journey schemas in Journey Optimizer AI, adjust routing rules in Action Type Router "
      },
      "typeVersion": 1
    },
    {
      "id": "97b1db17-512b-4011-a2e9-a06f837ee5a6",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1744,
        -160
      ],
      "parameters": {
        "color": 6,
        "height": 144,
        "content": "## Benefits\nReduces manual campaign management 80%, improves conversion via AI personalization "
      },
      "typeVersion": 1
    },
    {
      "id": "08db18db-db66-4426-985f-d3aa1065b626",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -496,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 880,
        "height": 800,
        "content": "## Data Ingestion\nConsolidates CRM records, purchase history, chat data, and customer attributes into a unified source for accurate profiling.\n\n**Why** - Unifies fragmented customer data for holistic understanding."
      },
      "typeVersion": 1
    },
    {
      "id": "e1721df8-a322-4387-bdc1-b26bfb15e458",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 368,
        "height": 800,
        "content": "## State Builder AI\nSynthesizes customer data using OpenAI to generate intelligent profiles \n\n**Why**- Transforms raw data into actionable intelligence for personalization."
      },
      "typeVersion": 1
    },
    {
      "id": "a8bd9d82-ba07-424f-a260-cb039e68ca00",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        784,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 528,
        "height": 800,
        "content": "## Journey Optimizer\nRoutes customers to appropriate next steps based on AI-generated profiles and predefined journey schemas\n.\n**Why**-Eliminates manual decision-making, ensuring timely and relevant actions."
      },
      "typeVersion": 1
    },
    {
      "id": "10e6c52b-d18a-4808-aa22-17e4e1a75853",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1328,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 464,
        "height": 800,
        "content": "## Action Router\nDirects customers to optimal channels, email for engagement, SMS for urgency, retargeting for recovery.\n\n**Why**- Maximizes effectiveness by matching message type to channel preference.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "eaaf507a-0f12-4194-8b8c-0ebab06c522d",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1808,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 208,
        "height": 816,
        "content": "\n## Performance Aggregation\nCollects metrics (opens, clicks, conversions) per journey variant.\n\n**Why**- Enables continuous optimization and demonstrates ROI."
      },
      "typeVersion": 1
    },
    {
      "id": "29eda750-184c-4cce-ad8e-e6df738db380",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -496,
        864
      ],
      "parameters": {
        "color": 7,
        "width": 1552,
        "height": 288,
        "content": "## Database Update\nPersists customer state and journey outcomes.\n\n**Why**- Maintains data consistency and enables future personalization cycles."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "a3a2ec33-ee1e-49ef-99a8-daf7164bf146",
  "connections": {
    "Fetch CRM Data": {
      "main": [
        [
          {
            "node": "Merge Customer Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send SMS Campaign": {
      "main": [
        [
          {
            "node": "Log Performance Metrics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Action Type Router": {
      "main": [
        [
          {
            "node": "Send Email Campaign",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send SMS Campaign",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create Retargeting Campaign",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Email History": {
      "main": [
        [
          {
            "node": "Merge Customer Data",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge Customer Data": {
      "main": [
        [
          {
            "node": "Customer State Builder AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Email Campaign": {
      "main": [
        [
          {
            "node": "Log Performance Metrics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Journey Optimizer AI": {
      "main": [
        [
          {
            "node": "Action Type Router",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Journey Stage Router": {
      "main": [
        [
          {
            "node": "Journey Optimizer AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Customer State Schema": {
      "ai_outputParser": [
        [
          {
            "node": "Customer State Builder AI",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Journey Action Schema": {
      "ai_outputParser": [
        [
          {
            "node": "Journey Optimizer AI",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Update Customer State": {
      "main": [
        [
          {
            "node": "Save Customer State to Database",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Performance Data": {
      "main": [
        [
          {
            "node": "Aggregate Journey Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Fetch CRM Data",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Email History",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Chat History",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Purchase History",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Model - Optimizer": {
      "ai_languageModel": [
        [
          {
            "node": "Journey Optimizer AI",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Touchpoint Event Webhook": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate Journey Results": {
      "main": [
        [
          {
            "node": "Update Customer State",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Customer State Builder AI": {
      "main": [
        [
          {
            "node": "Journey Stage Router",
            "type": "main",
            "index": 0
          },
          {
            "node": "Save Customer State to Database",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Retargeting Campaign": {
      "main": [
        [
          {
            "node": "Log Performance Metrics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Model - State Builder": {
      "ai_languageModel": [
        [
          {
            "node": "Customer State Builder AI",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Journey Optimization Schedule": {
      "main": [
        [
          {
            "node": "Fetch Performance Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}