{
  "name": "YouTube comment scraper & analyzer with GPT-4o + email summary report",
  "nodes": [
    {
      "id": "workflow-overview-note",
      "name": "Workflow Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -300,
        -250
      ],
      "parameters": {
        "width": 350,
        "height": 400,
        "content": "# 📊 YouTube Comment Analyzer Workflow\n\n**Purpose:** Automate YouTube comment collection, sentiment analysis, and email reporting\n\n**Schedule:** Triggers every minute for new/updated rows\n\n**Required S"
      }
    },
    {
      "id": "trigger-section-note",
      "name": "Trigger Documentation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -50,
        -250
      ],
      "parameters": {
        "width": 300,
        "height": 220,
        "content": "## 🚀 Trigger Section\n\n**Google Sheets Trigger**\nMonitors the spreadsheet every minute for:\n- New video IDs added\n- Status changes to 'Pending'\n\n**Required Sheet Structure:**\n| ID | Video Title | YouTu"
      }
    },
    {
      "id": "youtube-data-note",
      "name": "YouTube API Section",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        770,
        -250
      ],
      "parameters": {
        "width": 280,
        "height": 200,
        "content": "## 📹 YouTube Data Collection\n\n**This section fetches:**\n- Video metadata (title, channel)\n- Top 100 comments\n- Comment statistics\n\n**API Limits:**\n- Max 100 comments per request\n- Ordered by relevance"
      }
    },
    {
      "id": "ai-analysis-note",
      "name": "AI Analysis Documentation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1420,
        -280
      ],
      "parameters": {
        "width": 320,
        "height": 250,
        "content": "## 🤖 AI Analysis Section\n\n**GPT-4o analyzes comments for:**\n1. Sentiment breakdown (positive/negative/neutral)\n2. Main themes & topics\n3. Common viewer questions\n4. Key feedback points\n5. Actionable i"
      }
    },
    {
      "id": "email-update-note",
      "name": "Email & Status Update",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2036,
        -250
      ],
      "parameters": {
        "width": 300,
        "height": 220,
        "content": "## 📧 Email & Update Section\n\n**Email Report includes:**\n- Video statistics\n- Sentiment analysis\n- Key insights\n- Formatted HTML\n\n**Final Step:**\nUpdates Google Sheet status to 'Mail Sent' to prevent d"
      }
    },
    {
      "id": "data-prep-note",
      "name": "Data Processing Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1270,
        200
      ],
      "parameters": {
        "width": 250,
        "height": 180,
        "content": "⚠️ **Data Preparation**\n\nThis node:\n- Extracts comment texts\n- Calculates statistics\n- Performs basic sentiment analysis\n- Prepares data for AI\n\nLimited to 50 comments for AI analysis to manage token "
      }
    },
    {
      "id": "b5d9ad95-9fcc-4c3d-bf90-42e897ab5eda",
      "name": "Limit",
      "type": "n8n-nodes-base.limit",
      "position": [
        440,
        0
      ]
    },
    {
      "id": "d0f82101-07e6-4559-9b73-91b85dc77b40",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1540,
        0
      ]
    },
    {
      "id": "e7a9b6ea-af4a-4970-ba0e-3e18608015f5",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1628,
        220
      ]
    },
    {
      "id": "7c22599f-6fa8-4461-9b81-89a283a9dc84",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        220,
        0
      ]
    },
    {
      "id": "152902fb-d715-4473-972f-4f75e5788b7a",
      "name": "Set Video Details",
      "type": "n8n-nodes-base.set",
      "position": [
        660,
        0
      ]
    },
    {
      "id": "67bb511b-478c-4fec-ba6a-816d81a8bad1",
      "name": "Get Youtube Video Details",
      "type": "n8n-nodes-base.youTube",
      "position": [
        880,
        0
      ]
    },
    {
      "id": "880379c3-791a-424f-a170-db214ee0bad0",
      "name": "Get Youtube Video Comments",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1100,
        0
      ]
    },
    {
      "id": "4a7f24c6-5dea-400f-8f0b-351597cae840",
      "name": "Prepare Comments Data",
      "type": "n8n-nodes-base.code",
      "position": [
        1320,
        0
      ]
    },
    {
      "id": "06ddd27a-242e-4975-82e4-2795af0252a7",
      "name": "Prepare HTML for Email",
      "type": "n8n-nodes-base.code",
      "position": [
        1916,
        0
      ]
    },
    {
      "id": "2c28a815-1e36-47ab-a96c-a3c040f60551",
      "name": "Gmail Account Configuration",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2136,
        0
      ]
    },
    {
      "id": "1303d6f5-d8a8-44ea-b062-ba25dbb43e6e",
      "name": "Update Status on Google Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2356,
        0
      ]
    },
    {
      "id": "f9028f08-170b-4d2f-8c6b-b1dbf470d3a3",
      "name": "Pick Video Ids from Google sheet",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        0,
        0
      ]
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit": {
      "main": [
        [
          {
            "node": "Set Video Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Prepare HTML for Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Set Video Details": {
      "main": [
        [
          {
            "node": "Get Youtube Video Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Comments Data": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare HTML for Email": {
      "main": [
        [
          {
            "node": "Gmail Account Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Youtube Video Details": {
      "main": [
        [
          {
            "node": "Get Youtube Video Comments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Youtube Video Comments": {
      "main": [
        [
          {
            "node": "Prepare Comments Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Account Configuration": {
      "main": [
        [
          {
            "node": "Update Status on Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Status on Google Sheet": {
      "main": [
        []
      ]
    },
    "Pick Video Ids from Google sheet": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}