This workflow corresponds to n8n.io template #18025 — we link there as the canonical source.
This workflow follows the Chainllm → Google Sheets 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 →
{
"id": "VPnO3z3g321jc3ym",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "AI Automated comment analysis",
"tags": [],
"nodes": [
{
"id": "35618d07-6c3f-4567-993e-2c541d9ae1b8",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
21568,
7888
],
"parameters": {
"width": 480,
"height": 896,
"content": "## AI Automated comment analysis\n### How it works\n\n1. The workflow listens for YouTube URLs submitted via a Telegram bot.\n2. It validates the URL format and fetches video details along with the top 100 comments.\n3. The comments are processed, cleaned of empty entries and duplicates, and aggregated into a single list.\n4. Google Gemini AI analyzes the audience sentiment and identifies repeated questions or themes.\n5. The AI then generates new video ideas based on these content opportunities and formats the report.\n6. The final analysis is saved to a Google Sheet and sent back to the user via Telegram.\n\n### Setup steps\n\n- [ ] Configure the Telegram Trigger node with your bot credentials.\n- [ ] Set up YouTube Data API credentials in the HTTP Request nodes to fetch video details and comments.\n- [ ] Authenticate the Google Gemini chat models with your API key.\n- [ ] Connect your Google Sheets account and specify the spreadsheet and worksheet IDs for saving results.\n- [ ] Update the Telegram node at the end to reply to the correct chat ID.\n\n### Customization\n\nYou can customize the prompts in the Google Gemini nodes to generate different formats of video ideas, or change the number of comments retrieved by tweaking the YouTube API parameters.\n\nWatch the workflow explanation: https://youtu.be/YtHfQONV4A4"
},
"typeVersion": 1
},
{
"id": "35cdf08d-5541-4977-a0b6-c5e1349416dc",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
22192,
8064
],
"parameters": {
"color": 7,
"width": 416,
"height": 304,
"content": "## Receive and read Telegram input\n\nListens for incoming messages from a Telegram bot and extracts the message text and chat ID."
},
"typeVersion": 1
},
{
"id": "acfa8edd-77d4-499a-92ec-6cbf5af76d47",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
22640,
7968
],
"parameters": {
"color": 7,
"width": 416,
"height": 512,
"content": "## Validate YouTube URL format\n\nChecks if the provided text is a valid YouTube URL, extracts the video ID if true, or replies with an error if invalid."
},
"typeVersion": 1
},
{
"id": "73f71824-4d1c-48a3-9e6a-8cb0082aaaec",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
23104,
8000
],
"parameters": {
"color": 7,
"width": 448,
"height": 304,
"content": "## Fetch YouTube video details\n\nCalls the YouTube API to fetch details about the video and its top 100 comments."
},
"typeVersion": 1
},
{
"id": "480178cb-4898-4acd-bcc1-e81b64e554e9",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
23664,
8000
],
"parameters": {
"color": 7,
"width": 848,
"height": 304,
"content": "## Parse and clean top comments\n\nSplits the comment data into individual items, normalizes fields, filters out empty comments, and removes any duplicates."
},
"typeVersion": 1
},
{
"id": "66861858-5ab5-4d6b-869f-27a9f8ac18a1",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
24528,
7904
],
"parameters": {
"color": 7,
"width": 304,
"height": 400,
"content": "## Aggregate cleaned YouTube comments\n\nCombines all the individual cleaned comments back into a single aggregated list to prepare for AI processing."
},
"typeVersion": 1
},
{
"id": "39c4ffde-f34d-49f9-9b42-e483ab15fd63",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
24864,
8000
],
"parameters": {
"color": 7,
"width": 720,
"height": 576,
"content": "## Analyze audience with AI\n\nPasses the aggregated comments to Google Gemini to analyze audience sentiment, identify repeated questions, and score content opportunities."
},
"typeVersion": 1
},
{
"id": "b56a3bbe-53b0-47c7-82ed-68a1238587b8",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
25632,
8000
],
"parameters": {
"color": 7,
"width": 512,
"height": 544,
"content": "## Generate video ideas using AI\n\nUses the Google Gemini model again to brainstorm new video ideas based on the analysis, and formats the report."
},
"typeVersion": 1
},
{
"id": "bada60a2-2188-4b0d-9cf4-e53c3044a54d",
"name": "Sticky Note8",
"type": "n8n-nodes-base.stickyNote",
"position": [
26208,
8000
],
"parameters": {
"color": 7,
"width": 432,
"height": 336,
"content": "## Save and send final results\n\nSaves the final AI-generated report into a Google Sheet and sends it back to the user via Telegram."
},
"typeVersion": 1
},
{
"id": "9ad979d3-6b51-41dc-9a34-9a70a6385617",
"name": "Telegram Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
22240,
8192
],
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "577d646b-2e9e-4169-81fd-76b8b2d92614",
"name": "Set Message Info",
"type": "n8n-nodes-base.set",
"position": [
22464,
8192
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "9795f7e0-de3a-4395-b365-8d72e5dafeb6",
"name": "messageText",
"type": "string",
"value": "={{ $json.message?.text || '' }}"
},
{
"id": "9962e20c-b22a-4936-b890-8d00289b4a26",
"name": "chatId",
"type": "number",
"value": "={{ $json.message?.chat?.id }}"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "30aad6dc-5445-42fb-8d7a-d7e7b495c509",
"name": "If Is YouTube URL",
"type": "n8n-nodes-base.if",
"position": [
22688,
8192
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "0ca5e6ea-f952-465f-a7bb-56407580b958",
"operator": {
"type": "string",
"operation": "regex"
},
"leftValue": "={{ $json.messageText }}",
"rightValue": "/(?:youtu\\.be\\/|youtube\\.com\\/(?:watch\\?(?:.*&)?v=|shorts\\/|embed\\/|live\\/))[A-Za-z0-9_-]{11}/i"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "3880ca5c-016b-48bf-a394-3712a2c2a11f",
"name": "Set Video ID",
"type": "n8n-nodes-base.set",
"position": [
22912,
8128
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "588d88fc-c5ba-4b96-be87-d192e59261ef",
"name": "videoId",
"type": "string",
"value": "={{\n($json.messageText.match(/(?:youtu\\.be\\/|youtube\\.com\\/(?:shorts\\/|embed\\/|live\\/))([A-Za-z0-9_-]{11})/i) || [])[1]\n||\n($json.messageText.match(/[?&]v=([A-Za-z0-9_-]{11})/i) || [])[1]\n||\n''\n}}"
},
{
"id": "6bcaca92-aaac-4c80-8978-5a1ed2c16d88",
"name": "videoUrl",
"type": "string",
"value": "={{\n'https://www.youtube.com/watch?v=' +\n(\n($json.messageText.match(/(?:youtu\\.be\\/|youtube\\.com\\/(?:shorts\\/|embed\\/|live\\/))([A-Za-z0-9_-]{11})/i) || [])[1]\n||\n($json.messageText.match(/[?&]v=([A-Za-z0-9_-]{11})/i) || [])[1]\n||\n''\n)\n}}"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "461f7c3c-e285-4fa9-ac2d-f03bb94d454f",
"name": "Send Invalid URL Reply",
"type": "n8n-nodes-base.telegram",
"position": [
22912,
8320
],
"parameters": {
"text": "Please send a valid YouTube video URL.",
"chatId": "={{ $json.chatId }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "ee80e96a-02fc-459f-8855-82a3ee705eb5",
"name": "Fetch YouTube Video Details",
"type": "n8n-nodes-base.httpRequest",
"maxTries": 3,
"position": [
23152,
8128
],
"parameters": {
"url": "https://www.googleapis.com/youtube/v3/videos",
"options": {
"timeout": 30000
},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "part",
"value": "snippet,statistics,contentDetails"
},
{
"name": "id",
"value": "={{ $('Set Video ID').first().json.videoId }}"
},
{
"name": "key",
"value": "enter-your-api-here"
}
]
}
},
"retryOnFail": true,
"typeVersion": 4.2,
"waitBetweenTries": 1500
},
{
"id": "df188d73-bb33-426c-a701-14d44b251492",
"name": "Fetch YouTube Comments",
"type": "n8n-nodes-base.httpRequest",
"maxTries": 3,
"position": [
23408,
8128
],
"parameters": {
"url": "https://www.googleapis.com/youtube/v3/commentThreads",
"options": {
"timeout": 30000
},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "part",
"value": "snippet"
},
{
"name": "videoId",
"value": "={{ $('Set Video ID').first().json.videoId }}"
},
{
"name": "maxResults",
"value": "100"
},
{
"name": "order",
"value": "relevance"
},
{
"name": "textFormat",
"value": "plainText"
},
{
"name": "key",
"value": "enter-your-api-key-here"
}
]
}
},
"retryOnFail": true,
"typeVersion": 4.2,
"waitBetweenTries": 1500
},
{
"id": "29bc963a-4ab8-4ded-806f-d5b6d9a8acd3",
"name": "Split Comment Items",
"type": "n8n-nodes-base.splitOut",
"position": [
23712,
8128
],
"parameters": {
"options": {},
"fieldToSplitOut": "items"
},
"typeVersion": 1
},
{
"id": "189a612a-c8c6-44b3-9d0c-f5f1f47926e4",
"name": "Set Comment Fields",
"type": "n8n-nodes-base.set",
"position": [
23936,
8128
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "895a04dc-996c-4c78-acab-9dd45b54b4bd",
"name": "commentText",
"type": "string",
"value": "=\n{{ $json.snippet.topLevelComment.snippet.textOriginal }}"
},
{
"id": "0e08aed9-12bf-4eb6-a8ab-7b2e36ebf0e7",
"name": "likeCount",
"type": "number",
"value": "={{ $json.snippet.topLevelComment.snippet.likeCount }}"
},
{
"id": "42a1cc83-d7ef-45a0-b479-fc69ffa21009",
"name": "author",
"type": "string",
"value": "={{ $json.snippet.topLevelComment.snippet.authorDisplayName }}"
},
{
"id": "249d115f-6a16-4d55-9baa-b08f8b8923ba",
"name": "publishedAt",
"type": "string",
"value": "={{ $json.snippet.topLevelComment.snippet.publishedAt }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "c9e49181-b88d-4d9f-89d7-04b3a010cdcb",
"name": "Filter Empty Comments",
"type": "n8n-nodes-base.filter",
"position": [
24160,
8128
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "4defd3ee-f79a-4f07-823c-4f7796ecea88",
"operator": {
"type": "string",
"operation": "notEmpty",
"singleValue": true
},
"leftValue": "={{ $json.commentText }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "4d7ddb10-0069-49af-a29a-64e3aa5bf55c",
"name": "Deduplicate by Comment Text",
"type": "n8n-nodes-base.removeDuplicates",
"position": [
24368,
8128
],
"parameters": {
"compare": "selectedFields",
"options": {},
"fieldsToCompare": "commentText"
},
"typeVersion": 2
},
{
"id": "7b7c24aa-c244-4be9-a4ff-c25ba0fe226b",
"name": "Merge Comments",
"type": "n8n-nodes-base.aggregate",
"position": [
24592,
8128
],
"parameters": {
"include": "specifiedFields",
"options": {},
"aggregate": "aggregateAllItemData",
"fieldsToInclude": "commentText,likeCount,author,publishedAt",
"destinationFieldName": "comments"
},
"typeVersion": 1
},
{
"id": "92e9c38c-17ee-4d68-b937-6660c63baf27",
"name": "Analyze Audience Agent",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"maxTries": 3,
"position": [
24912,
8128
],
"parameters": {
"text": "={{\n'Analyze this YouTube audience using only the metadata and comments below.\\n\\n' +\n'TITLE: ' + (($('Fetch YouTube Video Details').first().json.items || [])[0]?.snippet?.title || '') + '\\n' +\n'CHANNEL: ' + (($('Fetch YouTube Video Details').first().json.items || [])[0]?.snippet?.channelTitle || '') + '\\n\\n' +\n'COMMENTS:\\n' + JSON.stringify($json.comments || [])\n}}",
"batching": {},
"promptType": "define",
"hasOutputParser": true
},
"retryOnFail": true,
"typeVersion": 1.7,
"waitBetweenTries": 2000
},
{
"id": "35b59a45-0876-412a-8ecf-88b2508f4420",
"name": "Parse Structured Output",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
25136,
8416
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{\"type\": \"object\", \"properties\": {\"audience_summary\": {\"type\": \"string\"}, \"audience_segments\": {\"type\": \"array\", \"items\": {\"type\": \"string\"}}, \"sentiment\": {\"type\": \"object\", \"properties\": {\"positive\": {\"type\": \"number\"}, \"neutral\": {\"type\": \"number\"}, \"negative\": {\"type\": \"number\"}}, \"required\": [\"positive\", \"neutral\", \"negative\"]}, \"pain_points\": {\"type\": \"array\", \"items\": {\"type\": \"string\"}}, \"desires\": {\"type\": \"array\", \"items\": {\"type\": \"string\"}}, \"repeated_questions\": {\"type\": \"array\", \"items\": {\"type\": \"object\", \"properties\": {\"question\": {\"type\": \"string\"}, \"estimated_frequency\": {\"type\": \"integer\"}, \"why_it_matters\": {\"type\": \"string\"}}, \"required\": [\"question\", \"estimated_frequency\", \"why_it_matters\"]}}, \"content_opportunities\": {\"type\": \"array\", \"items\": {\"type\": \"object\", \"properties\": {\"topic\": {\"type\": \"string\"}, \"evidence\": {\"type\": \"string\"}, \"demand_score\": {\"type\": \"number\"}, \"pain_score\": {\"type\": \"number\"}, \"novelty_score\": {\"type\": \"number\"}, \"final_score\": {\"type\": \"number\"}}, \"required\": [\"topic\", \"evidence\", \"demand_score\", \"pain_score\", \"novelty_score\", \"final_score\"]}}}, \"required\": [\"audience_summary\", \"audience_segments\", \"sentiment\", \"pain_points\", \"desires\", \"repeated_questions\", \"content_opportunities\"]}"
},
"typeVersion": 1.3
},
{
"id": "b6d11df7-de02-4ab3-b18f-9f4fe1df9149",
"name": "Gemini Chat Model Audience",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
24912,
8416
],
"parameters": {
"options": {
"temperature": 0.2
},
"modelName": "models/gemini-3.1-flash-lite"
},
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "6c88665d-0f0f-41e7-bddf-d94bcad36471",
"name": "Set Repeated Questions",
"type": "n8n-nodes-base.set",
"position": [
25216,
8128
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "ca6fb9ec-f9b0-44fb-af49-ae108cb4c338",
"name": "analysis",
"type": "object",
"value": "={{ $json.output }}"
},
{
"id": "3d84ca1b-0b67-4ce9-b18b-81044749190b",
"name": "repeatedQuestions",
"type": "array",
"value": "={{ ($json.output?.repeated_questions || []).slice(0,5) }}"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "0b796d13-757f-4fcd-83c4-e364dbb8c813",
"name": "Set Content Opportunities",
"type": "n8n-nodes-base.set",
"position": [
25440,
8128
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "04b3d04a-2e2d-452f-a1d0-00cfaf012ec1",
"name": "topOpportunities",
"type": "array",
"value": "={{ ($json.output?.content_opportunities || []).sort((a,b) => (b.final_score || 0) - (a.final_score || 0)).slice(0,5) }}"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "366d0692-92ea-467f-ad58-468aef2721a8",
"name": "Generate Video Ideas Agent",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"maxTries": 3,
"position": [
25680,
8128
],
"parameters": {
"text": "={{\n'Create exactly 7 YouTube video ideas using this audience research.\\n\\n' +\n'REPEATED QUESTIONS:\\n' + JSON.stringify($json.repeatedQuestions || []) + '\\n\\n' +\n'TOP OPPORTUNITIES:\\n' + JSON.stringify($json.topOpportunities || []) + '\\n\\n' +\n'Format each idea as: TITLE \u2014 Hook: ... | Why: ...\\n' +\n'No intro. No conclusion. Keep under 1800 characters.'\n}}",
"batching": {},
"promptType": "define"
},
"retryOnFail": true,
"typeVersion": 1.7,
"waitBetweenTries": 2000
},
{
"id": "71110919-0a84-40d0-acab-a11f10a0e14b",
"name": "Build Final Report",
"type": "n8n-nodes-base.set",
"position": [
26000,
8128
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "2563e280-81fb-435a-8bb4-ed7179920330",
"name": "timestamp",
"type": "string",
"value": "={{ $now.toISO() }}"
},
{
"id": "d403e38e-9516-4dd5-9f7f-841195cdd568",
"name": "video_id",
"type": "string",
"value": "={{ $('Set Video ID').first().json.videoId }}"
},
{
"id": "57bcdc78-6d52-408e-9528-60d76dc05e1f",
"name": "video_url",
"type": "string",
"value": "={{ $('Set Video ID').first().json.videoUrl }}"
},
{
"id": "462994a0-5158-4364-857a-ecfb8b4cbfdf",
"name": "video_title",
"type": "string",
"value": "={{ (($('Fetch YouTube Video Details').first().json.items || [])[0]?.snippet?.title || '') }}"
},
{
"id": "685b4a05-57f4-449e-9e97-9b103e1e27c4",
"name": "channel",
"type": "string",
"value": "={{ (($('Fetch YouTube Video Details').first().json.items || [])[0]?.snippet?.channelTitle || '') }}"
},
{
"id": "6a274a53-f53a-4577-8592-7ebb9f38b456",
"name": "analyzed_comments",
"type": "number",
"value": "={{ ($('Merge Comments').first().json.comments || []).length }}"
},
{
"id": "2762309d-d5fa-4f42-920c-b275c882f579",
"name": "audience_summary",
"type": "string",
"value": "={{ $('Set Content Opportunities').first().json.output?.audience_summary || '' }}"
},
{
"id": "3362682e-abd7-4571-a14b-90b6fb713edc",
"name": "repeated_questions",
"type": "string",
"value": "={{ JSON.stringify($('Set Content Opportunities').first().json.repeatedQuestions || []) }}"
},
{
"id": "8b967b91-129a-44a5-812c-bcc3e0dce829",
"name": "content_opportunities",
"type": "string",
"value": "={{ JSON.stringify($('Set Content Opportunities').first().json.topOpportunities || []) }}"
},
{
"id": "1c7dd858-6940-4b79-9f34-6d256633dad1",
"name": "video_ideas",
"type": "string",
"value": "={{ $json.text || $json.output || '' }}"
},
{
"id": "daa8ff23-5f17-4d72-9d6c-b643bff48ada",
"name": "telegram_report",
"type": "string",
"value": "={{\n(() => {\nconst video = (($('Fetch YouTube Video Details').first().json.items || [])[0] || {});\nconst a = $('Set Content Opportunities').first().json.output || {};\nconst qs = $('Set Content Opportunities').first().json.repeatedQuestions || [];\nconst ops = $('Set Content Opportunities').first().json.topOpportunities || [];\nconst s = a.sentiment || {};\nlet ideas = $json.text || $json.output || '';\nif (typeof ideas !== 'string') ideas = JSON.stringify(ideas);\n\nconst report = [\n'\ud83c\udfaf YOUTUBE AUDIENCE ANALYSIS',\n'',\n'\ud83d\udcf9 ' + (video.snippet?.title || 'Unknown title'),\n'\ud83d\udc64 ' + (video.snippet?.channelTitle || 'Unknown channel'),\n'\ud83d\udcac Comments analyzed: ' + (($('Merge Comments').first().json.comments || []).length),\n'',\n'\ud83d\udc65 AUDIENCE SUMMARY',\na.audience_summary || 'No summary returned.',\n'',\n'\ud83d\ude42 Sentiment: +' + (s.positive ?? '?') + '% / \ud83d\ude10 ' + (s.neutral ?? '?') + '% / \ud83d\ude41 ' + (s.negative ?? '?') + '%',\n'',\n'\u2753 REPEATED QUESTIONS',\nqs.length ? qs.map((q,i) => `${i+1}. ${q.question} (~${q.estimated_frequency || '?'} mentions)`).join('\\n') : 'No strong repeated questions detected.',\n'',\n'\ud83d\ude80 TOP CONTENT OPPORTUNITIES',\nops.length ? ops.map((o,i) => `${i+1}. ${o.topic} \u2014 ${o.final_score ?? '?'} / 10`).join('\\n') : 'No strong opportunities detected.',\n'',\n'\ud83c\udfac NEXT VIDEO IDEAS',\nideas\n].join('\\n');\n\nreturn report.length > 3900 ? report.slice(0,3890) + '\\n\u2026' : report;\n})()\n}}"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "51e82bac-43b1-4804-a42b-0b3a0c3849a9",
"name": "Append Analysis to Sheets",
"type": "n8n-nodes-base.googleSheets",
"position": [
26256,
8128
],
"parameters": {
"columns": {
"value": {},
"schema": [
{
"id": "telegram_report",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "telegram_report",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "autoMapInputData",
"matchingColumns": [
"telegram_report"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 374395096,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/11fEmUoxnEQW-ouDCBmE_YTsjmCPgvTt1WIom1tVCZs4/edit#gid=374395096",
"cachedResultName": "youtube comments "
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "11fEmUoxnEQW-ouDCBmE_YTsjmCPgvTt1WIom1tVCZs4",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/11fEmUoxnEQW-ouDCBmE_YTsjmCPgvTt1WIom1tVCZs4/edit?usp=drivesdk",
"cachedResultName": "triage log"
},
"authentication": "serviceAccount"
},
"credentials": {
"googleApi": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "03a17cd0-2a3e-4867-aa7b-98b30d476fab",
"name": "Send Results to Telegram",
"type": "n8n-nodes-base.telegram",
"maxTries": 3,
"position": [
26496,
8128
],
"parameters": {
"text": "={{ $('Build Final Report').first().json.telegram_report }}",
"chatId": "={{ $('Set Message Info').first().json.chatId }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 1.2,
"waitBetweenTries": 1000
},
{
"id": "f85a183f-5d8b-4164-84b6-55eec3509d85",
"name": "Gemini Chat Model Ideas",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
25680,
8384
],
"parameters": {
"options": {},
"modelName": "models/gemini-3.1-flash-lite"
},
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.1
}
],
"active": false,
"settings": {
"binaryMode": "separate",
"availableInMCP": false,
"executionOrder": "v1"
},
"versionId": "ba9d7296-bc83-43b7-b296-8da03ef095c8",
"nodeGroups": [],
"connections": {
"Set Video ID": {
"main": [
[
{
"node": "Fetch YouTube Video Details",
"type": "main",
"index": 0
}
]
]
},
"Merge Comments": {
"main": [
[
{
"node": "Analyze Audience Agent",
"type": "main",
"index": 0
}
]
]
},
"Set Message Info": {
"main": [
[
{
"node": "If Is YouTube URL",
"type": "main",
"index": 0
}
]
]
},
"Telegram Trigger": {
"main": [
[
{
"node": "Set Message Info",
"type": "main",
"index": 0
}
]
]
},
"If Is YouTube URL": {
"main": [
[
{
"node": "Set Video ID",
"type": "main",
"index": 0
}
],
[
{
"node": "Send Invalid URL Reply",
"type": "main",
"index": 0
}
]
]
},
"Build Final Report": {
"main": [
[
{
"node": "Append Analysis to Sheets",
"type": "main",
"index": 0
}
]
]
},
"Set Comment Fields": {
"main": [
[
{
"node": "Filter Empty Comments",
"type": "main",
"index": 0
}
]
]
},
"Split Comment Items": {
"main": [
[
{
"node": "Set Comment Fields",
"type": "main",
"index": 0
}
]
]
},
"Filter Empty Comments": {
"main": [
[
{
"node": "Deduplicate by Comment Text",
"type": "main",
"index": 0
}
]
]
},
"Analyze Audience Agent": {
"main": [
[
{
"node": "Set Repeated Questions",
"type": "main",
"index": 0
}
]
]
},
"Fetch YouTube Comments": {
"main": [
[
{
"node": "Split Comment Items",
"type": "main",
"index": 0
}
]
]
},
"Set Repeated Questions": {
"main": [
[
{
"node": "Set Content Opportunities",
"type": "main",
"index": 0
}
]
]
},
"Gemini Chat Model Ideas": {
"ai_languageModel": [
[
{
"node": "Generate Video Ideas Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Parse Structured Output": {
"ai_outputParser": [
[
{
"node": "Analyze Audience Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Append Analysis to Sheets": {
"main": [
[
{
"node": "Send Results to Telegram",
"type": "main",
"index": 0
}
]
]
},
"Set Content Opportunities": {
"main": [
[
{
"node": "Generate Video Ideas Agent",
"type": "main",
"index": 0
}
]
]
},
"Gemini Chat Model Audience": {
"ai_languageModel": [
[
{
"node": "Analyze Audience Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Generate Video Ideas Agent": {
"main": [
[
{
"node": "Build Final Report",
"type": "main",
"index": 0
}
]
]
},
"Deduplicate by Comment Text": {
"main": [
[
{
"node": "Merge Comments",
"type": "main",
"index": 0
}
]
]
},
"Fetch YouTube Video Details": {
"main": [
[
{
"node": "Fetch YouTube Comments",
"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.
googleApigooglePalmApitelegramApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow accepts a YouTube video URL via Telegram, pulls the video metadata and top 100 comments using the YouTube Data API, analyzes audience sentiment and themes with Google Gemini, generates new video ideas, logs the report to Google Sheets, and replies with the results…
Source: https://n8n.io/workflows/18025/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This workflow creates a multi-talented AI assistant named Simran that interacts with users via Telegram. It can handle text and voice messages, understand the user's intent, and perform various tasks.
This automation is designed to help you generate AI-powered music tracks, cover art, and fully rendered music videos — all triggered from a simple Telegram chat and managed via Google Sheets.
LinkedIn URL → Scrape → Match → Screen → Decide, all automated
This workflow contains community nodes that are only compatible with the self-hosted version of n8n.
This workflow contains community nodes that are only compatible with the self-hosted version of n8n.