{
  "name": "Analyze Facebook comment sentiment with GPT-4, Slack, Sheets & Outlook reports",
  "nodes": [
    {
      "id": "e0f900e3-e48a-4795-9bd7-a5ccb42d3aa6",
      "name": "Main Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1008,
        -1392
      ],
      "parameters": {
        "width": 420,
        "height": 668,
        "content": "## Facebook Sentiment Monitor – Overview\n\nThis workflow automatically tracks new Facebook posts and comments, analyzes audience sentiment using AI, and routes the results to alerts, logs, and daily re"
      }
    },
    {
      "id": "d8799315-9170-426d-a89e-f8c1647ed494",
      "name": "Data Collection Group",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1008,
        -688
      ],
      "parameters": {
        "width": 392,
        "height": 316,
        "content": "## Data Collection\nFetches recent Facebook posts, reactions, and comments on a daily schedule.  \nGroups all retrieval steps before processing.\n"
      }
    },
    {
      "id": "1174ab64-c4ef-43fd-9549-083603267c5a",
      "name": "AI Analysis Group",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -352,
        -656
      ],
      "parameters": {
        "width": 464,
        "height": 464,
        "content": "## AI Sentiment Analysis\nEvaluates sentiment for posts and comments using GPT and outputs structured JSON.\n"
      }
    },
    {
      "id": "3dc35ae3-4a8c-4557-be24-b69cec7508fe",
      "name": "Routing Logic",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        128,
        -672
      ],
      "parameters": {
        "width": 280,
        "height": 312,
        "content": "## Routing Logic\nRoutes negative sentiment to alerts and logs, while positive/neutral flows go to reporting.\n"
      }
    },
    {
      "id": "17ca8b08-897f-42cb-bdea-14cc092a04de",
      "name": "Alerts & Reporting",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        416,
        -848
      ],
      "parameters": {
        "width": 480,
        "height": 660,
        "content": "## Alerts & Logging\nSends Slack alerts for negative sentiment and updates Google Sheets for tracking trends.\n"
      }
    },
    {
      "id": "d8910011-bab9-4cd2-8549-29ec54527fce",
      "name": "Error Handling",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -960,
        144
      ],
      "parameters": {
        "width": 616,
        "height": 260,
        "content": "## Error Handling\nCaptures workflow failures and sends details to Slack for quick debugging.\n"
      }
    },
    {
      "id": "3ff16e53-59e8-4d1e-ac52-4cd35fb1cdc9",
      "name": "Error Handler Trigger",
      "type": "n8n-nodes-base.errorTrigger",
      "position": [
        -784,
        256
      ]
    },
    {
      "id": "e872c20b-75f7-412e-8c8e-3b38d1860eb7",
      "name": "Slack: Send Error Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        -576,
        256
      ]
    },
    {
      "id": "53d2eab6-4686-4608-a0c3-17ab64a2f981",
      "name": "Fetch Recent Facebook Posts",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        -752,
        -544
      ]
    },
    {
      "id": "253741a6-d741-410f-8fa9-c93b1bc3588d",
      "name": "💬 Agent - Sentiment & Tone Evaluator",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -224,
        -544
      ]
    },
    {
      "id": "f489eeba-46f0-47ee-8bee-365d6c51b52e",
      "name": "Route Based on Sentiment Score",
      "type": "n8n-nodes-base.switch",
      "position": [
        208,
        -544
      ]
    },
    {
      "id": "4c816578-1372-4441-86ee-e6bfb3ba4cb7",
      "name": "Slack Alert - Negative Sentiment",
      "type": "n8n-nodes-base.slack",
      "position": [
        704,
        -768
      ]
    },
    {
      "id": "3c2d3443-cb45-48bd-b16f-c8ac444c8e51",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        -656
      ],
      "parameters": {
        "width": null,
        "height": 272,
        "content": "## Data Formatting\nNormalizes Facebook API data into a consistent structure for downstream AI analysis.\n"
      }
    },
    {
      "id": "0cc0d69f-6365-45ac-a3c6-8a2b4ca81e97",
      "name": "LLM - OpenAI GPT-4 Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -272,
        -320
      ]
    },
    {
      "id": "e9612735-bc0c-4c97-866c-2f009c67e996",
      "name": "Memory Buffer - Session Context",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -144,
        -320
      ]
    },
    {
      "id": "eef0d55e-1adf-454e-a319-4ac721c0feb2",
      "name": "Structured JSON Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -16,
        -320
      ]
    },
    {
      "id": "9f4f35ae-ba39-48cc-9303-0b7b996a23ae",
      "name": "Format Facebook Data (Code Node)",
      "type": "n8n-nodes-base.code",
      "position": [
        -496,
        -544
      ]
    },
    {
      "id": "76ab3da1-46ca-4d90-833d-a6c1faabcf7d",
      "name": "Trigger - Daily Sentiment Analysis",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -992,
        -544
      ]
    },
    {
      "id": "37e98fd9-1a99-4c03-84e4-0ba922727c86",
      "name": "Format HTML Email Report (Code Node)",
      "type": "n8n-nodes-base.code",
      "position": [
        432,
        -352
      ]
    },
    {
      "id": "ab4f20d4-c34b-4529-bb98-f11b6554524a",
      "name": "Prepare Data for Google Sheets",
      "type": "n8n-nodes-base.code",
      "position": [
        432,
        -544
      ]
    },
    {
      "id": "31a51d00-433e-400a-b4cd-3972461093bc",
      "name": "Update Google Sheet - Sentiment Log",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        656,
        -544
      ]
    },
    {
      "id": "db65a4a0-c870-4f2a-bcd8-688d2e1e0cb2",
      "name": "Send Sentiment Report (Outlook)",
      "type": "n8n-nodes-base.microsoftOutlook",
      "position": [
        656,
        -352
      ]
    }
  ],
  "connections": {
    "Error Handler Trigger": {
      "main": [
        [
          {
            "node": "Slack: Send Error Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured JSON Parser": {
      "ai_outputParser": [
        [
          {
            "node": "💬 Agent - Sentiment & Tone Evaluator",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "LLM - OpenAI GPT-4 Model": {
      "ai_languageModel": [
        [
          {
            "node": "💬 Agent - Sentiment & Tone Evaluator",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Recent Facebook Posts": {
      "main": [
        [
          {
            "node": "Format Facebook Data (Code Node)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Data for Google Sheets": {
      "main": [
        [
          {
            "node": "Update Google Sheet - Sentiment Log",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route Based on Sentiment Score": {
      "main": [
        [
          {
            "node": "Slack Alert - Negative Sentiment",
            "type": "main",
            "index": 0
          },
          {
            "node": "Prepare Data for Google Sheets",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Format HTML Email Report (Code Node)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Memory Buffer - Session Context": {
      "ai_memory": [
        [
          {
            "node": "💬 Agent - Sentiment & Tone Evaluator",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Format Facebook Data (Code Node)": {
      "main": [
        [
          {
            "node": "💬 Agent - Sentiment & Tone Evaluator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger - Daily Sentiment Analysis": {
      "main": [
        [
          {
            "node": "Fetch Recent Facebook Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format HTML Email Report (Code Node)": {
      "main": [
        [
          {
            "node": "Send Sentiment Report (Outlook)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "💬 Agent - Sentiment & Tone Evaluator": {
      "main": [
        [
          {
            "node": "Route Based on Sentiment Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}