{
  "name": "Extract insights & analyse YouTube comments via AI agent chat",
  "nodes": [
    {
      "id": "f4b3833b-cf25-4bbc-927c-080586c5713c",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        700,
        760
      ],
      "parameters": {
        "width": 330.5152611046425,
        "height": 239.5888196628349,
        "content": "### ... or watch set up video [13 min]\n[![Youtube Thumbnail](https://cflobdhpqwnoisuctsoc.supabase.co/storage/v1/object/public/my_storage/Youtube%20AI%20Agent%20Blur.png)](https://youtu.be/6RmLZS8Yl4E"
      }
    },
    {
      "id": "64d96c53-b3e2-4aea-9a29-9b9e5c729f4f",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        240
      ],
      "parameters": {
        "width": 636.2128494576581,
        "height": 497.1532689930921,
        "content": "![5min Logo](https://cflobdhpqwnoisuctsoc.supabase.co/storage/v1/object/public/my_storage/banner.png)\n## AI Agent To Chat With Youtube\n**Made by [Mark Shcherbakov](https://www.linkedin.com/in/marklowc"
      }
    },
    {
      "id": "57d2ede9-1bf9-4449-9dc9-af1ccee763b6",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        760
      ],
      "parameters": {
        "width": 280.2462120317618,
        "height": 545.9087885077763,
        "content": "### Set up steps\n\n1. **API Setup**:\n   - Create a [Google Cloud](https://console.cloud.google.com/apis/dashboard) project and enable the YouTube Data API.\n   - Generate an API key for [Apify](https://"
      }
    },
    {
      "id": "ca0fd549-88a7-44fd-ab81-7fd5ca140dae",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1540,
        820
      ]
    },
    {
      "id": "7f2cf209-2e9d-4d6a-bc9e-d1bfd6df7266",
      "name": "get_channel_details",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        1900,
        820
      ]
    },
    {
      "id": "c02f5c19-6e50-4a06-95b9-eceb3eec1012",
      "name": "get_video_description",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        2020,
        820
      ]
    },
    {
      "id": "2d61160b-3a65-4766-ace6-947a7c5de6e5",
      "name": "get_list_of_videos",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        2140,
        820
      ]
    },
    {
      "id": "c5aa2f7c-7748-4f88-abb6-fd274ad1295a",
      "name": "get_list_of_comments",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        2260,
        820
      ]
    },
    {
      "id": "c68cad77-1d71-45a3-b94b-8f7c701f56fb",
      "name": "search",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        2380,
        820
      ]
    },
    {
      "id": "c87d5392-8a5c-4999-9e58-89a5e0700c40",
      "name": "analyze_thumbnail",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        2500,
        820
      ]
    },
    {
      "id": "1be2fa35-9091-4db8-a8eb-50f822d618d3",
      "name": "video_transcription",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        2620,
        820
      ]
    },
    {
      "id": "fbfcd82f-e247-4a21-be12-339df7afe681",
      "name": "Postgres Chat Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
      "position": [
        1700,
        820
      ]
    },
    {
      "id": "6a4bbad9-27ab-448b-9222-2c8843fe241a",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1760,
        560
      ]
    },
    {
      "id": "739cc12a-27d1-48e9-b124-7f83fb372514",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        1460,
        600
      ]
    },
    {
      "id": "613af9f2-77fa-42c4-86d3-87e20f2c0c89",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1380,
        500
      ],
      "parameters": {
        "width": 1430.34590072234,
        "height": 588.1344471094899,
        "content": "## Scenario 1: AI agent"
      }
    },
    {
      "id": "54116346-bc73-4a6a-8bca-f2a6e6699374",
      "name": "Get Comments",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2064,
        1598
      ]
    },
    {
      "id": "faabf71a-69f2-4113-802e-124a09fa9a0a",
      "name": "Execute Workflow Trigger",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        1444,
        1598
      ]
    },
    {
      "id": "4b3ec3aa-7c69-4a72-a989-02f97acdf612",
      "name": "Get Channel Details",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2064,
        1278
      ]
    },
    {
      "id": "ed8dec73-8c50-4eb9-8efe-68ee72c4d5e6",
      "name": "Get Video Description",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2064,
        1438
      ]
    },
    {
      "id": "c1ff3837-8d7e-49ad-a333-c177833fcd05",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        2224,
        1598
      ]
    },
    {
      "id": "5f0c44fe-2523-4170-a27d-0ccd1bef24a7",
      "name": "Run Query",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2064,
        1758
      ]
    },
    {
      "id": "3e192718-6710-4143-ac6e-15df79ee5363",
      "name": "Get Videos by Channel",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2064,
        1918
      ]
    },
    {
      "id": "8bcb50a4-0cd1-4311-ac6a-2ee8653cfb71",
      "name": "Response",
      "type": "n8n-nodes-base.set",
      "position": [
        2564,
        1598
      ]
    },
    {
      "id": "7f5a36d3-6710-4e69-8459-7c8c748ee7d9",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        1624,
        1578
      ]
    },
    {
      "id": "df432d53-33bf-4e91-9ead-7f4b36bd788a",
      "name": "Get Video Transcription",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2064,
        2238
      ]
    },
    {
      "id": "8079e5c9-4a52-45ce-ac41-7fc707177a5a",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        2064,
        2078
      ]
    },
    {
      "id": "7847e82a-fe82-498c-8c14-4c1c718d632c",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1380,
        1140
      ],
      "parameters": {
        "width": 1427.3810326521016,
        "height": 1313.2689194736308,
        "content": "## Scenario 2: Agent tools"
      }
    },
    {
      "id": "3a0fbbb0-4c0e-41f1-abb3-c87e955ad1b3",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1540,
        960
      ],
      "parameters": {
        "width": 266.7375650720483,
        "height": 80,
        "content": "### Replace credentials"
      }
    },
    {
      "id": "363eaca0-aaa5-4551-845f-528f19bba57a",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2004,
        1178
      ],
      "parameters": {
        "width": 266.7375650720483,
        "height": 80,
        "content": "### Replace credentials in all nodes - Apify, OpenAI, Google"
      }
    }
  ],
  "connections": {
    "OpenAI": {
      "main": [
        [
          {
            "node": "Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Get Channel Details",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Video Description",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Comments",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Run Query",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Videos by Channel",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "OpenAI",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Video Transcription",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "search": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Run Query": {
      "main": [
        [
          {
            "node": "Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Comments": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "analyze_thumbnail": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "get_list_of_videos": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get Channel Details": {
      "main": [
        [
          {
            "node": "Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "get_channel_details": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "video_transcription": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Postgres Chat Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "get_list_of_comments": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get Video Description": {
      "main": [
        [
          {
            "node": "Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Videos by Channel": {
      "main": [
        [
          {
            "node": "Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "get_video_description": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get Video Transcription": {
      "main": [
        [
          {
            "node": "Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Workflow Trigger": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}