Automate YouTube Insights Extraction with n8n AI Agent

Struggling to analyze YouTube video data and comments? This n8n automation workflow extracts comprehensive insights from YouTube channels and videos using APIs and AI analysis, saving hours of manual research.
agent
httpRequest
lmChatOpenAi
+14
Workflow Identifier: 1099
NODES in Use: Sticky Note, OpenAI Chat Model, Switch, Get Channel Details, Get Video Description, Get Comments, Run Query, Get Videos by Channel, analyze_thumbnail, video_transcription, OpenAI, Postgres Chat Memory, AI Agent, When chat message received, Edit Fields, Get Video Transcription, Execute Workflow Trigger
Automate YouTube Insights with n8n and AI Agent

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What This Automation Does

This n8n workflow automates getting YouTube channel info, videos, comments, transcripts, and thumbnail analysis.

It solves the problem of wasting time collecting video data and comments manually.

The workflow saves hours and gives clear insights fast.

It uses YouTube Data API, OpenAI, and Apify to get channel details, video lists, analyze comments with sentiment, transcribe videos, and check thumbnails.

It stores chat memory in Postgres for smart conversations.

Results help content creators make better videos and grow their audience.


Inputs, Processing, and Outputs

Inputs

  • User sends a chat message with commands via webhook.
  • Channel handle, video ID, or search query included.
  • API keys for YouTube, OpenAI, and Apify configured in credentials.

Processing Steps

  • The chat trigger in the Webhook node receives message.
  • AI Agent node reads message and decides action.
  • Switch node routes command to proper YouTube API call or transcription.
  • Get Channel Details node retrieves channel ID and info by handle.
  • Run Query or Get Videos by Channel node fetch videos by channel or search terms.
  • Get Comments node gathers top comments and replies for videos.
  • Edit Fields node formats comments for easy reading.
  • Get Video Transcription node uses Apify to convert video audio to text.
  • OpenAI node analyzes thumbnails with custom prompts.
  • Postgres node manages chat history to keep conversations clear.

Outputs

  • Formatted JSON or text answers sent back to chat interface.
  • Video insights including channel data, comments with sentiment, transcripts, and thumbnail reviews.

Who Should Use This Workflow

Content creators with YouTube channels who want to understand their audience quickly can use this.

This helps marketers, strategists, or managers who want fast, reliable video data without manual work.

You do not need deep technical skills once setup is done.


Tools and Services Used

  • YouTube Data API: Gets channel, video, and comment info.
  • OpenAI: Processes chat inputs, analyzes thumbnails, and extracts sentiment.
  • Apify: Transcribes video audio to text.
  • Postgres: Stores chat session data for memory.
  • n8n: Runs the workflow with Webhook node, Switch node, and HTTP Request nodes.

Beginner Step-by-Step: How to Use This Workflow in n8n

Step 1: Import the Workflow

  1. Download the workflow JSON file using the Download button on this page.
  2. Open n8n editor where workflows are managed.
  3. Click “Import from File” and select the downloaded JSON file.

Step 2: Configure Credentials

  1. Go to Credentials in n8n.
  2. Add your API keys for Google Cloud (YouTube Data API), OpenAI, Apify, and Postgres if used.
  3. Confirm keys are correct and saved.

Step 3: Update IDs and URLs

  1. If needed, update channel handles, video URLs, or table names in input nodes.
  2. Check any prompt or JSON code snippets for placeholders and replace with your values.

Step 4: Test the Workflow

  1. Trigger the workflow by sending a sample chat message to the URL from the Webhook node.
  2. Watch the execution in n8n editor to see if data returns properly.
  3. Fix any credential or input errors if results are missing.

Step 5: Activate Workflow for Production

  1. Toggle the workflow status to ON.
  2. Use your front-end or chat system connected to the webhook URL to send real user requests.
  3. Regularly monitor API key limits and errors in n8n dashboard.
  4. If self hosting n8n, consider self-host n8n for more control and reliability.

Important Code Snippets and Prompts

Apify Video Transcription JSON Body

Paste this in the Get Video Transcription node body field to transcribe video URL from input:

{
 "startUrls": [
 "{{ $('Execute Workflow Trigger').item.json.query.video_url }}"
 ]
}

Formatting YouTube Comments (Example JavaScript)

Used in Edit Fields node to make comments readable:

items.map(item => {
  let comments = '';
  item.json.comments.forEach(comment => {
    comments += comment.author + ': ' + comment.text + '\n';
    if(comment.replies) {
      comment.replies.forEach(reply => {
        comments += '  ' + reply.author + ': ' + reply.text + '\n';
      });
    }
  });
  item.json.formattedComments = comments;
  return item;
});

Custom Prompt for Thumbnail Analysis

Set this in OpenAI node prompt field:

Analyze the thumbnail image at this URL.
Give feedback about design, colors, and how well it might catch viewers’ attention.
Suggest improvements to increase engagement.

Troubleshooting Common Issues

  • HTTP 403 Forbidden from YouTube nodes: Check if YouTube Data API is enabled and API key is valid.
  • Empty comments: Confirm video ID is correct and comments are public.
  • Transcription fails: Use public video URLs and verify Apify API key.
  • AI Agent gives wrong answers: Check OpenAI key and update prompt for clarity.

Customization Ideas

  • Change video sorting order in search nodes for top viewed or newest.
  • Add an OpenAI sentiment analysis node on comments for positive or negative feedback.
  • Update thumbnail prompt to focus on brand colors or style guides.
  • Adjust chat memory length in Postgres for longer or shorter conversations.
  • Batch process many channels by adding a loop over a channel list.

Summary of Benefits and Results

✓ The workflow automates YouTube data gathering fast.

✓ Saves hours of manual video and comment review work.

✓ Gives clear, formatted insights for better content decisions.

✓ Combines APIs and AI for an easier way to understand channel performance.

→ Users get more audience knowledge and improved video strategies.

→ Workflow runs automatically from chat messages, so data is always fresh.


Automate YouTube Insights with n8n and AI Agent

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

Download the workflow JSON, open n8n editor, use Import from File, then configure API keys and test once.
You need API keys for YouTube Data API from Google, OpenAI, Apify, and optionally Postgres database.
It sends the video URL to Apify transcription API which returns the text transcript.
OpenAI analyzes the thumbnail image URL to give feedback on design and audience appeal.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.