{
  "id": "wdnS1Xzfzj36cpHJ",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "AI Business Intelligence & Morning Change Detection System",
  "tags": [],
  "nodes": [
    {
      "id": "2e5a629a-d5f0-4e4a-a8ce-12a76345ad02",
      "name": "Section \u2013 Error Handling",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2800,
        5392
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "04621430-7154-45fc-af54-cdf00d100a30",
      "name": "On Workflow Error",
      "type": "n8n-nodes-base.errorTrigger",
      "position": [
        -2656,
        5616
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "eaa91d75-aa2c-43cd-81d7-a034a77eb364",
      "name": "Slack \u2013 Post Workflow Error Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        -2384,
        5616
      ],
      "parameters": {},
      "typeVersion": 2.3
    },
    {
      "id": "88effcb2-1796-46ae-8426-d0f78115915c",
      "name": "Overview \u2013 What Changed Digest",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3584,
        3152
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "4b2bcae1-025f-4486-9659-be33036af500",
      "name": "Section \u2013 Trigger & Configuration",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2976,
        4224
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "33af9f81-0ad9-4275-84a7-041c316ce3db",
      "name": "Section \u2013 Competitor Pricing Watch",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2176,
        3088
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "0608caa0-e9ce-4fc0-b02a-500df71ba545",
      "name": "Section \u2013 Google Ranking Watch",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2000,
        3840
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "ab59ffab-4b13-40ae-968c-b3ba97d04392",
      "name": "Section \u2013 Revenue Anomaly Watch",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1904,
        4528
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "127a7b8a-512a-4708-8182-4029a4733035",
      "name": "Section \u2013 Customer Churn Watch",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1968,
        5072
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "c8cd519f-84b4-4acf-8ad4-dc7dfabca268",
      "name": "Section \u2013 Digest Generation & Delivery",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -432,
        4208
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "9f732845-df04-4e80-8b84-9ee4894ef947",
      "name": "Credentials & Security Notes",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        5168
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "f955e387-aae0-44d7-b203-b6c1eef88a4e",
      "name": "Filter - Ranking Reportable Only",
      "type": "n8n-nodes-base.filter",
      "position": [
        -1072,
        4272
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "135af4a2-1ad4-499b-b05d-d0e787a5920e",
      "name": "Filter - Churn Reportable Only",
      "type": "n8n-nodes-base.filter",
      "position": [
        -1168,
        5296
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "e9fc921c-4f23-4051-a435-c87a7a34f4a5",
      "name": "AI - Generate Morning Digest",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        384,
        4384
      ],
      "parameters": {},
      "typeVersion": 1.8
    },
    {
      "id": "cb5ecd32-c416-42c2-82ac-b15a75fbcc47",
      "name": "Schedule Trigger - 8AM Daily",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -2784,
        4448
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "8a2f153d-134c-4570-a148-3b75f6480972",
      "name": "Config - Settings",
      "type": "n8n-nodes-base.set",
      "position": [
        -2560,
        4448
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "17f7cf1f-1eb1-445c-aef1-31ca1a0cff5f",
      "name": "Sheets - Read Competitor Baseline",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1952,
        3344
      ],
      "parameters": {},
      "typeVersion": 4.5
    },
    {
      "id": "27f778c1-53d7-4f6e-b2ba-cd41bacb383f",
      "name": "Sheets - Update Competitor Baseline",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -704,
        3328
      ],
      "parameters": {},
      "typeVersion": 4.5
    },
    {
      "id": "33533113-21a6-4437-b060-31f8508fa8f2",
      "name": "Sheets - Read Ranking Baseline",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1872,
        4112
      ],
      "parameters": {},
      "typeVersion": 4.5
    },
    {
      "id": "5933fb20-ca8b-49b3-8fe4-3ed26f711944",
      "name": "HTTP - SerpApi Rank Check",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1632,
        4112
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "beeecc35-04e4-4499-ae52-a3fd625168eb",
      "name": "Code - Compare Ranking",
      "type": "n8n-nodes-base.code",
      "position": [
        -1392,
        4112
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "5b6ad718-0107-48a6-a410-6978648b930c",
      "name": "Sheets - Update Ranking Baseline",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1040,
        3968
      ],
      "parameters": {},
      "typeVersion": 4.5
    },
    {
      "id": "f7aea279-ab4a-440e-9331-381ecb5000a6",
      "name": "Sheets - Read Revenue Log",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1744,
        4736
      ],
      "parameters": {},
      "typeVersion": 4.5
    },
    {
      "id": "382b10a4-23a5-43f2-955e-abf25609fd4c",
      "name": "Code - Detect Revenue Anomaly",
      "type": "n8n-nodes-base.code",
      "position": [
        -1280,
        4736
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "ba33ddd9-b376-4fdb-9282-10cd97b6ba5d",
      "name": "Sheets - Read Customer Status",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1856,
        5296
      ],
      "parameters": {},
      "typeVersion": 4.5
    },
    {
      "id": "3d23541a-04b2-4f4f-a8c4-81a768201214",
      "name": "Code - Detect Churn",
      "type": "n8n-nodes-base.code",
      "position": [
        -1616,
        5296
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "89c8baaa-f8ab-4282-8eb1-c488b87120a5",
      "name": "Sheets - Update Churn Baseline",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1152,
        5648
      ],
      "parameters": {},
      "typeVersion": 4.5
    },
    {
      "id": "8db7cabe-47f3-405a-830e-ebee6e74eb14",
      "name": "Merge - Combine All Signals",
      "type": "n8n-nodes-base.merge",
      "position": [
        -368,
        4448
      ],
      "parameters": {},
      "typeVersion": 3.1
    },
    {
      "id": "9e7dd685-9324-4ee6-bca6-121c0b0c9ca3",
      "name": "Code - Build Changes List",
      "type": "n8n-nodes-base.code",
      "position": [
        -112,
        4480
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "bcf9a36c-14ba-4b50-abc4-995232f77c17",
      "name": "IF - Any Changes Detected",
      "type": "n8n-nodes-base.if",
      "position": [
        128,
        4480
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "d2a5f2e7-d040-49f6-9f45-18c28a937f6e",
      "name": "Code - Parse OpenAI Response",
      "type": "n8n-nodes-base.code",
      "position": [
        768,
        4384
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "2c2a91c5-cfcb-4175-8e48-b9b9e4bf0036",
      "name": "Telegram - Send Digest",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1008,
        4384
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "b2c57e87-bace-4d2b-9f54-f48622303ea1",
      "name": "Gmail - Send Digest Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1248,
        4384
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "6df730aa-0ca7-49a6-b64e-d96dbdc3dba4",
      "name": "Telegram - Send No Changes",
      "type": "n8n-nodes-base.telegram",
      "position": [
        448,
        4768
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "4830e596-be24-43cd-9f7f-d2c23d5c4d04",
      "name": "AI - Fetch Competitor Pricing (Search)",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "onError": "continueErrorOutput",
      "position": [
        -1648,
        3344
      ],
      "parameters": {},
      "typeVersion": 1.4
    },
    {
      "id": "a1f3abec-c591-44cd-99d1-20d3ad1baaf5",
      "name": "Code - Calculate Pricing Changes",
      "type": "n8n-nodes-base.code",
      "position": [
        -1136,
        3328
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "0770f175-7e8d-47f3-a3cc-f9a75af89028",
      "name": "Slack - Post Pricing AI Error Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        -1296,
        3504
      ],
      "parameters": {},
      "typeVersion": 2.3
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "d144cd07-0c20-436f-9dd0-813312547d21",
  "nodeGroups": [],
  "connections": {
    "Config - Settings": {
      "main": [
        [
          {
            "node": "Sheets - Read Competitor Baseline",
            "type": "main",
            "index": 0
          },
          {
            "node": "Sheets - Read Ranking Baseline",
            "type": "main",
            "index": 0
          },
          {
            "node": "Sheets - Read Revenue Log",
            "type": "main",
            "index": 0
          },
          {
            "node": "Sheets - Read Customer Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On Workflow Error": {
      "main": [
        [
          {
            "node": "Slack \u2013 Post Workflow Error Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code - Detect Churn": {
      "main": [
        [
          {
            "node": "Sheets - Update Churn Baseline",
            "type": "main",
            "index": 0
          },
          {
            "node": "Filter - Churn Reportable Only",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code - Compare Ranking": {
      "main": [
        [
          {
            "node": "Sheets - Update Ranking Baseline",
            "type": "main",
            "index": 0
          },
          {
            "node": "Filter - Ranking Reportable Only",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram - Send Digest": {
      "main": [
        [
          {
            "node": "Gmail - Send Digest Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code - Build Changes List": {
      "main": [
        [
          {
            "node": "IF - Any Changes Detected",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP - SerpApi Rank Check": {
      "main": [
        [
          {
            "node": "Code - Compare Ranking",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF - Any Changes Detected": {
      "main": [
        [
          {
            "node": "AI - Generate Morning Digest",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Telegram - Send No Changes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sheets - Read Revenue Log": {
      "main": [
        [
          {
            "node": "Code - Detect Revenue Anomaly",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge - Combine All Signals": {
      "main": [
        [
          {
            "node": "Code - Build Changes List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI - Generate Morning Digest": {
      "main": [
        [
          {
            "node": "Code - Parse OpenAI Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code - Parse OpenAI Response": {
      "main": [
        [
          {
            "node": "Telegram - Send Digest",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger - 8AM Daily": {
      "main": [
        [
          {
            "node": "Config - Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code - Detect Revenue Anomaly": {
      "main": [
        [
          {
            "node": "Merge - Combine All Signals",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Sheets - Read Customer Status": {
      "main": [
        [
          {
            "node": "Code - Detect Churn",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter - Churn Reportable Only": {
      "main": [
        [
          {
            "node": "Merge - Combine All Signals",
            "type": "main",
            "index": 3
          }
        ]
      ]
    },
    "Sheets - Read Ranking Baseline": {
      "main": [
        [
          {
            "node": "HTTP - SerpApi Rank Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code - Calculate Pricing Changes": {
      "main": [
        [
          {
            "node": "Sheets - Update Competitor Baseline",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge - Combine All Signals",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter - Ranking Reportable Only": {
      "main": [
        [
          {
            "node": "Merge - Combine All Signals",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Sheets - Read Competitor Baseline": {
      "main": [
        [
          {
            "node": "AI - Fetch Competitor Pricing (Search)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack - Post Pricing AI Error Alert": {
      "main": [
        [
          {
            "node": "Sheets - Read Competitor Baseline",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI - Fetch Competitor Pricing (Search)": {
      "main": [
        [
          {
            "node": "Code - Calculate Pricing Changes",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Slack - Post Pricing AI Error Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}