AutomationFlowsAI & RAG › Generate Contextual Youtube Comments Automatically with Gpt-4o

Generate Contextual Youtube Comments Automatically with Gpt-4o

ByYaron Been @yaron-nofluff on n8n.io

This cutting-edge n8n workflow is a powerful automation tool designed to revolutionize how content creators and marketers engage with YouTube channels. By leveraging AI and the YouTube Data API, this workflow automatically: Discovers New Content: Monitors a specific YouTube…

Event trigger★★★★☆ complexityAI-powered11 nodesHTTP RequestAgentOpenAI Chat
AI & RAG Trigger: Event Nodes: 11 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #4580 — we link there as the canonical source.

This workflow follows the Agent → HTTP Request recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "xc36kbxHODDBimC1",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Youtube commentor",
  "tags": [],
  "nodes": [
    {
      "id": "6a95c116-f7c6-460a-97e6-1cefd90debf4",
      "name": "Check for New Video",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "2a280065-a28c-456a-abd9-9b0b1899f57f",
      "name": "Set Channel ID",
      "type": "n8n-nodes-base.set",
      "position": [
        220,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "9fb80084-4cf7-474e-af18-5957daccbf01",
              "name": "Channel 1 id",
              "type": "string",
              "value": "UC_x5XG1OV2P6uZZ5FSM9Ttw"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "5e8c588b-8d5d-4ccf-b9d3-e53374334d62",
      "name": "Fetch Latest Video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        440,
        0
      ],
      "parameters": {
        "url": "https://www.googleapis.com/youtube/v3/search",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "key",
              "value": "YOUR_API"
            },
            {
              "name": "channelId",
              "value": "={{ $json['Channel 1 id'] }}"
            },
            {
              "name": "order",
              "value": "date"
            },
            {
              "name": "maxResults",
              "value": "1"
            },
            {
              "name": "part",
              "value": "snippet"
            },
            {
              "name": "type",
              "value": "video"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "65a0a3da-106a-4017-b5f8-d27751f1fdb7",
      "name": "Commenter Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        760,
        0
      ],
      "parameters": {
        "text": "=Title: {{ $json.items[0].snippet.title }}\nDescription: {{ $json.items[0].snippet.description }}",
        "options": {
          "systemMessage": "You are a Youtube commenter. Comment on youtube based on video description and title."
        },
        "promptType": "define"
      },
      "typeVersion": 1.9
    },
    {
      "id": "15d6a657-dda7-4c71-b544-1789140072e4",
      "name": "Comment Writer",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        720,
        240
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c42cdc20-0b52-4a70-bb60-9700fe5b2580",
      "name": "Post Comment",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1200,
        0
      ],
      "parameters": {
        "url": "https://www.googleapis.com/youtube/v3/commentThreads",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"snippet\": {\n    \"videoId\": {{ $json.items[0].id.videoId }},\n    \"topLevelComment\": {\n      \"snippet\": {\n        \"textOriginal\": {{ $json.output }}\n      }\n    }\n  }\n}",
        "sendBody": true,
        "sendQuery": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "queryParameters": {
          "parameters": [
            {
              "name": "part",
              "value": "snippet"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_TOKEN_HERE Token"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "bf05fe2a-d11e-49a4-a1b5-bc749b3fee5c",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -40,
        -580
      ],
      "parameters": {
        "color": 5,
        "width": 620,
        "height": 780,
        "content": "## \ud83d\udfe9 **Section 1: \ud83c\udfaf Video Discovery**\n\n### Nodes:\n\n* \ud83d\udd52 **Check for New Video** (Schedule Trigger)\n* \u270f\ufe0f **Set Channel ID** (Edit Fields)\n* \ud83c\udf10 **Fetch Latest Video** (HTTP Request)\n\n### \ud83d\udd0d Description:\n\nThis group handles **detecting and fetching the latest video** from a specific YouTube channel.\n\n* **\ud83d\udd52 Schedule Trigger** runs at regular intervals (e.g., every hour) to check for new content.\n* **\u270f\ufe0f Set Channel ID** allows you to manually configure or dynamically inject the channel ID to target.\n* **\ud83c\udf10 Fetch Latest Video** calls the YouTube Data API (GET request) to pull metadata about the most recent upload \u2014 primarily the video ID and description.\n\n> \ud83d\udca1 **Purpose**: Ensures you always get the freshest video from the target channel to react to.\n\n---\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "b7c1a84c-9faf-4e95-bb95-928bf94a56fd",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        680,
        -640
      ],
      "parameters": {
        "color": 2,
        "width": 380,
        "height": 1020,
        "content": "## \ud83d\udfe8 **Section 2: \ud83e\udd16 Comment Creation**\n\n### Nodes:\n\n* \ud83e\udde0 **Generate Comment** (AI Agent)\n* \ud83e\uddfe **Comment Writer Model** (OpenAI Chat Model)\n\n### \u270d\ufe0f Description:\n\nThis is where the **magic happens** \u2014 the AI reads the video\u2019s description and writes a relevant, engaging comment.\n\n* **\ud83e\udde0 Generate Comment (AI Agent)** acts as the task coordinator. It uses the video description as context and issues a prompt to the OpenAI model.\n* **\ud83e\uddfe Comment Writer Model** is your **LLM** (like GPT-4 or GPT-3.5) that intelligently crafts a human-like, thoughtful comment that aligns with the content.\n\n> \ud83d\udca1 **Purpose**: Generate comments that feel organic, contextual, and engaging \u2014 potentially increasing visibility and interaction.\n\n---\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "e903ead7-d85e-4ef9-84d7-bd069a5d2af9",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1120,
        -580
      ],
      "parameters": {
        "color": 3,
        "width": 280,
        "height": 780,
        "content": "## \ud83d\udfe6 **Section 3: \ud83d\udce4 Comment Deployment**\n\n### Nodes:\n\n* \ud83d\udcec **Post Comment** (HTTP Request1)\n\n### \ud83d\ude80 Description:\n\nThis group is responsible for **publishing the AI-generated comment** directly on the video.\n\n* **\ud83d\udcec Post Comment** makes a POST request to the YouTube Data API, attaching the comment and video ID to publish it publicly.\n\n> \ud83d\udca1 **Purpose**: Automate the act of responding to fresh videos without human involvement.\n\n---\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "5e2d1a7f-b405-44ec-817a-68c509bcc5b5",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1540,
        -580
      ],
      "parameters": {
        "color": 4,
        "width": 1300,
        "height": 320,
        "content": "=======================================\n            WORKFLOW ASSISTANCE\n=======================================\nFor any questions or support, please contact:\n    Yaron@nofluff.online\n\nExplore more tips and tutorials here:\n   - YouTube: https://www.youtube.com/@YaronBeen/videos\n   - LinkedIn: https://www.linkedin.com/in/yaronbeen/\n=======================================\n"
      },
      "typeVersion": 1
    },
    {
      "id": "63e86a55-daf1-4b64-a2e5-94e9526627dd",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1540,
        -240
      ],
      "parameters": {
        "color": 4,
        "width": 1289,
        "height": 1838,
        "content": "## \ud83d\udfe9 **Section 1: \ud83c\udfaf Video Discovery**\n\n### Nodes:\n\n* \ud83d\udd52 **Check for New Video** (Schedule Trigger)\n* \u270f\ufe0f **Set Channel ID** (Edit Fields)\n* \ud83c\udf10 **Fetch Latest Video** (HTTP Request)\n\n### \ud83d\udd0d Description:\n\nThis group handles **detecting and fetching the latest video** from a specific YouTube channel.\n\n* **\ud83d\udd52 Schedule Trigger** runs at regular intervals (e.g., every hour) to check for new content.\n* **\u270f\ufe0f Set Channel ID** allows you to manually configure or dynamically inject the channel ID to target.\n* **\ud83c\udf10 Fetch Latest Video** calls the YouTube Data API (GET request) to pull metadata about the most recent upload \u2014 primarily the video ID and description.\n\n> \ud83d\udca1 **Purpose**: Ensures you always get the freshest video from the target channel to react to.\n\n---\n\n## \ud83d\udfe8 **Section 2: \ud83e\udd16 Comment Creation**\n\n### Nodes:\n\n* \ud83e\udde0 **Generate Comment** (AI Agent)\n* \ud83e\uddfe **Comment Writer Model** (OpenAI Chat Model)\n\n### \u270d\ufe0f Description:\n\nThis is where the **magic happens** \u2014 the AI reads the video\u2019s description and writes a relevant, engaging comment.\n\n* **\ud83e\udde0 Generate Comment (AI Agent)** acts as the task coordinator. It uses the video description as context and issues a prompt to the OpenAI model.\n* **\ud83e\uddfe Comment Writer Model** is your **LLM** (like GPT-4 or GPT-3.5) that intelligently crafts a human-like, thoughtful comment that aligns with the content.\n\n> \ud83d\udca1 **Purpose**: Generate comments that feel organic, contextual, and engaging \u2014 potentially increasing visibility and interaction.\n\n---\n\n## \ud83d\udfe6 **Section 3: \ud83d\udce4 Comment Deployment**\n\n### Nodes:\n\n* \ud83d\udcec **Post Comment** (HTTP Request1)\n\n### \ud83d\ude80 Description:\n\nThis group is responsible for **publishing the AI-generated comment** directly on the video.\n\n* **\ud83d\udcec Post Comment** makes a POST request to the YouTube Data API, attaching the comment and video ID to publish it publicly.\n\n> \ud83d\udca1 **Purpose**: Automate the act of responding to fresh videos without human involvement.\n\n---\n\n## \ud83e\udde9 Optional Enhancements (Future Groups):\n\n* \ud83d\udce6 **Group: Logging & History**\n\n  * Store each video ID + timestamp + posted comment in a DB (e.g., PostgreSQL or Google Sheets).\n* \ud83d\udd10 **Group: Authentication**\n\n  * Manage OAuth2 token refreshing and storage for YouTube API access.\n\n---\n\n### \ud83d\udccc Summary Visual:\n\n```\n\ud83d\udfe9 Group 1: \ud83c\udfaf Video Discovery\n  \u2514\u2500\u2500 \ud83d\udd52 Schedule \u2192 \u270f\ufe0f Channel ID \u2192 \ud83c\udf10 Fetch Video\n\n\ud83d\udfe8 Group 2: \ud83e\udd16 Comment Creation\n  \u2514\u2500\u2500 \ud83e\udde0 AI Agent \u2192 \ud83e\uddfe OpenAI Model\n\n\ud83d\udfe6 Group 3: \ud83d\udce4 Comment Deployment\n  \u2514\u2500\u2500 \ud83d\udcec Post Comment\n```\n\n\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "507bae91-627c-44ae-89d5-0e05a607152e",
  "connections": {
    "Comment Writer": {
      "ai_languageModel": [
        [
          {
            "node": "Commenter Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Set Channel ID": {
      "main": [
        [
          {
            "node": "Fetch Latest Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Commenter Agent": {
      "main": [
        [
          {
            "node": "Post Comment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Latest Video": {
      "main": [
        [
          {
            "node": "Commenter Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check for New Video": {
      "main": [
        [
          {
            "node": "Set Channel ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This cutting-edge n8n workflow is a powerful automation tool designed to revolutionize how content creators and marketers engage with YouTube channels. By leveraging AI and the YouTube Data API, this workflow automatically: Discovers New Content: Monitors a specific YouTube…

Source: https://n8n.io/workflows/4580/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

K&S-Media Downloadliste SQL. Uses httpRequest, agent, googleSheets, lmChatOpenAi. Event-driven trigger; 97 nodes.

HTTP Request, Agent, Google Sheets +3
AI & RAG

🎯 Create viral TikToks, Shorts, Reels, podcasts, and ASMR videos in minutes — all on autopilot.

OpenAI, HTTP Request, Form Trigger +7
AI & RAG

Generate AI viral videos with NanoBanana & VEO3, shared on socials via Blotato 2. Uses @blotato/n8n-nodes-blotato, googleSheets, lmChatOpenAi, toolThink. Event-driven trigger; 94 nodes.

@Blotato/N8N Nodes Blotato, Google Sheets, OpenAI Chat +9
AI & RAG

RAG CHATBOT Main. Uses telegram, telegramTrigger, lmChatOpenAi, n8n-nodes-mcp. Event-driven trigger; 87 nodes.

Telegram, Telegram Trigger, OpenAI Chat +8
AI & RAG

The best content automation template in the market is now even better—with “deep research” on time-sensitive topics\! Unlike most n8n content automation templates that are mainly for “demo purposes,”

OpenAI, HTTP Request, XML +11