{
  "name": "X (Twitter) brand sentiment analysis with Gemini AI & Slack alerts",
  "nodes": [
    {
      "id": "59dc116b-2c89-4dd0-a65d-707c9c19a7d0",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        656,
        -1104
      ]
    },
    {
      "id": "4a4011b2-34e4-460d-aeaa-16f7d268387e",
      "name": "Append row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        880,
        -1104
      ]
    },
    {
      "id": "86afb72d-92d7-460c-b9c0-5d96674c7931",
      "name": "Count",
      "type": "n8n-nodes-base.set",
      "position": [
        -240,
        -1040
      ]
    },
    {
      "id": "ae1ff19a-ff35-4cba-9269-1eeff32763ca",
      "name": "counter",
      "type": "n8n-nodes-base.set",
      "position": [
        -16,
        -1040
      ]
    },
    {
      "id": "f0abc5af-dddc-48df-b916-0b7d79835171",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        1360,
        -1120
      ]
    },
    {
      "id": "38daa357-3e8f-46a5-8256-37717205b53d",
      "name": "Limit",
      "type": "n8n-nodes-base.limit",
      "position": [
        256,
        -896
      ]
    },
    {
      "id": "91a1fc06-52d9-4aef-af97-151199bded57",
      "name": "set increase",
      "type": "n8n-nodes-base.set",
      "position": [
        480,
        -896
      ]
    },
    {
      "id": "306f0c25-2e3a-4d2a-8d6a-4c50f3873ecf",
      "name": "Code1",
      "type": "n8n-nodes-base.code",
      "position": [
        704,
        -896
      ]
    },
    {
      "id": "639373f6-2282-49c6-bf3c-fe2fc14baf9b",
      "name": "set count and cursor",
      "type": "n8n-nodes-base.set",
      "position": [
        1152,
        -848
      ]
    },
    {
      "id": "143ba536-5062-4f1f-8930-8a3c1b1d0ac7",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        208,
        -1104
      ]
    },
    {
      "id": "bcb717ef-5bd5-444b-8aa3-4921774b109a",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        -272,
        -448
      ]
    },
    {
      "id": "eda67442-2198-4692-bbdb-8db08dbf576f",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        32,
        -304
      ]
    },
    {
      "id": "e441a2b2-7abf-4c1f-a8d6-9a910474d85b",
      "name": "getTweetsFromDatabase",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        448,
        -320
      ]
    },
    {
      "id": "3edca455-922f-4956-8f45-6a47fd8024d2",
      "name": "Append row in sheet1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1136,
        -480
      ]
    },
    {
      "id": "a9435786-bbe9-4f10-871c-97d1ccd314a0",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1728,
        -688
      ]
    },
    {
      "id": "cd92a7ce-d58d-4291-b128-d67373128b2b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1184,
        -1120
      ],
      "parameters": {
        "width": 640,
        "height": 320,
        "content": "# 🎯  The Collector & Analyst Workflow\n\n## This is the heart of our 'Brand Sentry' system. Its entire job is to **find new tweets** about our brand, **save them** to a database, and then have our first"
      }
    },
    {
      "id": "b41a6ef6-be6b-49a7-acd8-d335d07796d1",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        -1296
      ],
      "parameters": {
        "width": 624,
        "height": 544,
        "content": "# 🚀 Starting the Engine\n\n\n## This is our starting point. These first couple of nodes are just for setup. They initialize a **counter** and set our **search term** ('emergentlabs'). This gets the proce"
      }
    },
    {
      "id": "5aeb7918-f3cd-4796-956d-b390ba82bca5",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        -1328
      ],
      "parameters": {
        "width": 1856,
        "height": 752,
        "content": "# 🐦 The Tweet Collector (Loop)\n\n## This entire section is a powerful loop that automatically finds new tweets. It calls the **Twitter API** to get a batch of tweets, a **Code node** cleans up the mess"
      }
    },
    {
      "id": "2fdc6db0-a947-42bf-ae04-f4869c7fd224",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -736,
        -688
      ],
      "parameters": {
        "width": 352,
        "height": 480,
        "content": "# 🤔 The Gatekeeper\n\n## This **Switch** node acts as a simple gatekeeper. After the tweet collection is done, it checks if we actually found any new tweets. If the sheet is empty, it stops. If we found"
      }
    },
    {
      "id": "9277459d-8348-41a2-87fe-1c2fc3ca9bf8",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        -160
      ],
      "parameters": {
        "width": 800,
        "height": 352,
        "content": "# 🧠 The AI Analyst\n\n## This is where the magic happens. The **AI Agent** is our first 'brain.' It wakes up and uses its special **Google Sheets Tool** to read all the raw, unprocessed tweets we just c"
      }
    },
    {
      "id": "5a9c2c81-2b56-4f42-b606-0dff90cb5242",
      "name": "Translator",
      "type": "n8n-nodes-base.code",
      "position": [
        752,
        -480
      ]
    },
    {
      "id": "4c9bf29e-084e-47d1-8e69-c22b3bc34876",
      "name": "Tweet Scraper",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        432,
        -1104
      ]
    },
    {
      "id": "a2679e6f-eb6f-4e44-ac7f-a3f550a95976",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        -320
      ],
      "parameters": {
        "width": 320,
        "height": 512,
        "content": "# 🧹 The Translator\n\n##  The AI gives us back its analysis as a single block of text. This **Code node** acts as a brilliant 'translator.' It reads that text, carefully **parses** it, and turns it into"
      }
    },
    {
      "id": "5c4fe7a8-3747-4489-8829-0d91b15919ce",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1024,
        -336
      ],
      "parameters": {
        "width": 400,
        "height": 720,
        "content": "# 💾 System Memory\n\n## Here, we take the clean, structured analysis from the translator and save each one as a new row in our second, more important Google Sheet: the **'AI Analysis' sheet**. This shee"
      }
    },
    {
      "id": "ec4bf437-8fdb-468f-abda-06f98fc6d37c",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -432,
        -1008
      ]
    },
    {
      "id": "331ce67e-1830-4cc6-82c0-7e5ea2ccad26",
      "name": "AI Analyst",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        192,
        -480
      ]
    },
    {
      "id": "6ecb4d34-0fb5-4467-b298-09ddcc98bc65",
      "name": "Google Gemini Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        976,
        1264
      ]
    },
    {
      "id": "3aff36f1-2d9d-4d7a-836c-8c622bc8d67c",
      "name": "Get row(s) in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        304,
        1024
      ]
    },
    {
      "id": "bc97d230-329b-46d0-ba78-525ac0b0f6dc",
      "name": "parseAlerts",
      "type": "n8n-nodes-base.code",
      "position": [
        1472,
        1104
      ]
    },
    {
      "id": "cc2e2d5e-1f82-4cac-a8d8-6b5229ebde78",
      "name": "Send a message",
      "type": "n8n-nodes-base.slack",
      "position": [
        1696,
        912
      ]
    },
    {
      "id": "ede3bb3e-34b6-4a8f-b708-068cb54c5a87",
      "name": "Send a message1",
      "type": "n8n-nodes-base.slack",
      "position": [
        1920,
        1104
      ]
    },
    {
      "id": "888243e5-3d56-4d5d-9e7b-9135e21282a2",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1696,
        1104
      ]
    },
    {
      "id": "0f91c2bf-c478-4c5b-8a7b-96e747347d87",
      "name": "Strategist Agent",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        944,
        1008
      ]
    },
    {
      "id": "4d2ec48f-415f-4fd4-824f-27506b8f0cb7",
      "name": "parser",
      "type": "n8n-nodes-base.code",
      "position": [
        608,
        1072
      ]
    },
    {
      "id": "55265036-18e2-44bb-8427-685219a56eea",
      "name": "summary",
      "type": "n8n-nodes-base.code",
      "position": [
        1472,
        912
      ]
    },
    {
      "id": "65f4b982-4196-4315-9b8f-caf5a2c03388",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -512,
        896
      ],
      "parameters": {
        "width": 512,
        "height": 320,
        "content": "# 🎯  The Strategist Workflow\n\n## This workflow is our 'Intelligence Director'. Its job is to read all the analyses performed by our other workflows, create a single high-level strategic summary, and d"
      }
    },
    {
      "id": "15bd2e16-77cd-499a-9ca1-40b732a14a56",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        16,
        576
      ],
      "parameters": {
        "width": 480,
        "height": 880,
        "content": "# 📊 1. Reading the \"To-Do\" List\n\n## This workflow starts by connecting to our 'AI Analysis' Google Sheet. It carefully reads only the rows where the \"action taken\" column is marked as \"Notmarked\", ens"
      }
    },
    {
      "id": "b2f0cd05-fe05-486a-a7a6-604369ab4091",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        592
      ],
      "parameters": {
        "width": 288,
        "height": 864,
        "content": "# 📚 2. Compiling the Briefing Book\n\n## This Code node takes all the individual rows of analysis from the sheet and combines them into a single, neatly formatted text block. "
      }
    },
    {
      "id": "7b62b892-025c-4d71-9673-5a1ab509fb09",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        832,
        560
      ],
      "parameters": {
        "width": 416,
        "height": 896,
        "content": "# 👑 3. The Strategist AI\n\n## This is our second, more powerful 'brain'. The Basic LLM Chain reads the entire briefing book we just compiled. Its mission is to synthesize all that information and gener"
      }
    },
    {
      "id": "71eb9e89-8314-4324-9b43-6441e9711b55",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1264,
        560
      ],
      "parameters": {
        "width": 656,
        "height": 496,
        "content": "# 📜 4a. The Summary Report Path\n\n## In this path, the first Code node (named 'Code') extracts only the text summary from the AI's output. It then passes this clean report to a Slack node, which posts "
      }
    },
    {
      "id": "153bf685-006e-416c-aaf9-40b89625b2c1",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1264,
        1072
      ],
      "parameters": {
        "width": 816,
        "height": 496,
        "content": "\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# 🚨 4b. The Urgent Alerts Path\n\n## This second path is for high-priority items. The 'parseAlerts' Code node extracts the JSON list of urgent tweets. The 'Loop Over Items' node th"
      }
    },
    {
      "id": "a2d428b0-4ccd-4f74-a38e-35af8474022a",
      "name": "Schedule Trigger1",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        48,
        1056
      ]
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Tweet Scraper",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code1": {
      "main": [
        [
          {
            "node": "set count and cursor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Count": {
      "main": [
        [
          {
            "node": "counter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit": {
      "main": [
        [
          {
            "node": "set increase",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "AI Analyst",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "parser": {
      "main": [
        [
          {
            "node": "Strategist Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "counter": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "summary": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Analyst": {
      "main": [
        [
          {
            "node": "Translator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Translator": {
      "main": [
        [
          {
            "node": "Append row in sheet1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "parseAlerts": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "set increase": {
      "main": [
        [
          {
            "node": "Code1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tweet Scraper": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Send a message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message1": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Count",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Strategist Agent": {
      "main": [
        [
          {
            "node": "summary",
            "type": "main",
            "index": 0
          },
          {
            "node": "parseAlerts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger1": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "parser",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet1": {
      "main": [
        []
      ]
    },
    "set count and cursor": {
      "main": [
        [
          {
            "node": "counter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "getTweetsFromDatabase": {
      "ai_tool": [
        [
          {
            "node": "AI Analyst",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Analyst",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Strategist Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}