AI Agent for YouTube Data Extraction and Audience Analysis - n8n Workflow

Build a powerful n8n workflow using an AI agent to analyze YouTube comments, video transcripts, and thumbnails. Leverage OpenAI, Apify, and Google APIs for comprehensive content intelligence.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Content Creators and Marketers needing deep audience insights.
Data analysts looking to automate YouTube research and competitive analysis.
n8n users interested in building advanced AI agents with LangChain tools.
Developers seeking complex n8n templates for multimedia integration.

Overview

This sophisticated n8n workflow transforms how you gather content insights. Instead of manually reviewing thousands of YouTube comments or video descriptions, this automation utilizes a robust AI agent powered by OpenAI, complemented by specialized tools built as sub-workflows within n8n. This powerful n8n workflow allows the agent to execute specific, complex actions like retrieving channel details, analyzing audience sentiment from comments, transcribing entire videos, and even critiquing video thumbnails using vision capabilities. This comprehensive approach provides actionable data for optimizing future content strategy, making this a crucial n8n workflow for any serious digital marketer. It demonstrates how to combine core n8n node functionality with advanced AI orchestration.

How it Works

This solution is structured as a powerful, conversational AI agent utilizing internal n8n tools (Workflow Tool nodes) to handle complex YouTube data fetching and analysis.


  1. Initiation: The process begins with the When chat message received n8n trigger, capturing the user's input query to the AI agent. This is the starting point for the entire n8n workflow.

  2. Agent Processing: The core AI Agent n8n node, configured with a system message guiding it as a 'Youtube assistant,' interprets the user request. It uses the Postgres Chat Memory n8n node to maintain conversation history and context across interactions.

  3. Tool Selection: Based on the user's intent, the Agent dynamically selects the most appropriate tool from the defined set, such as getlistofcomments or videotranscription.

  4. Tool Execution: The selected toolWorkflow executes, functioning as a call to a separate, linked n8n workflow. This secondary workflow begins with an Execute Workflow Trigger which receives the necessary parameters (command and query).

  5. Data Fetching & Routing: A subsequent Switch n8n node directs the flow to the correct data retrieval path (e.g., Get Comments via the YouTube Data API, or Get Video Transcription via Apify).

  6. AI Analysis: For tasks like analyze_thumbnail, the flow uses a dedicated OpenAI n8n node configured for image analysis, critiquing the visual content based on the agent's prompt.

  7. Result Return: The result from the specific task (e.g., cleaned comments data via the Edit Fields n8n node) is returned through a Response node back to the primary AI Agent n8n workflow, which synthesizes the final answer for the user.

Installation Guide

To deploy this powerful n8n workflow, which relies on modularity and linking n8n templates, careful credential setup is essential.


  1. Import: Import the provided n8n workflow JSON file into your n8n instance. Note that this workflow relies on a linked helper workflow (implied by the toolWorkflow n8n node configurations, referenced by ID FgknOUpOBkpY85NX), which must also be imported or recreated.

  2. API Keys & Credentials: You must configure three main credentials within your n8n setup:

OpenAI: Required for the OpenAI Chat Model and for the image analysis capabilities used in the analyze_thumbnail tool.
Google Cloud (YouTube Data API): Create a Google Cloud project, enable the YouTube Data API v3, and generate an API key. This key must be configured as a Generic HTTP Query Authentication credential for the YouTube httpRequest n8n node calls.
* Apify: Generate an API key for the Apify platform, specifically needed for the Get Video Transcription n8n node.

  1. Database Setup (Optional but Recommended): Configure a PostgreSQL database connection for the Postgres Chat Memory n8n node to maintain persistent chat history and context for the AI agent.

  2. Linking: Ensure all toolWorkflow n8n node instances correctly reference the ID of your imported 'Youtube parser - tools' helper workflow. If you use this n8n template structure, the agent will function immediately upon activation.

Node Details

This comprehensive n8n workflow leverages a wide array of specialized n8n node types:

When chat message received (n8n trigger): The primary entry point, initiating the conversation with the AI Agent.
AI Agent (LangChain Agent n8n node): The core intelligence. It is configured as an openAiFunctionsAgent and manages the execution flow, tool selection, and overall response synthesis.
OpenAI Chat Model (LangChain LM ChatOpenAi n8n node): Provides the underlying large language model (LLM) for processing user requests and generating coherent responses.
Postgres Chat Memory (LangChain Memory n8n node): Stores the conversational history, ensuring the AI agent retains context across multiple interactions within the n8n workflow.
Tool Workflow (7 instances): These specialized n8n nodes encapsulate complex external calls. Examples include getlistofcomments (for analyzing audience data) and videotranscription (for detailed content extraction).
Execute Workflow Trigger (n8n trigger): Acts as the entry point for the secondary, tool-handling workflow, receiving the specific command from the main AI Agent.
Switch (n8n node): Directs the incoming tool command to the correct data fetching operation in the helper workflow.
HTTP Request (n8n node): Used extensively for direct API calls, such as retrieving channel details, video descriptions, comments, and running search queries against the YouTube Data API v3. Also used to interface with Apify for video transcription.


  • OpenAI (n8n node): Dedicatedly used within the analyze_thumbnail tool to perform multimodal image analysis based on specific prompts.

Related n8n Workflows

Free

Nodes: 11 Nodes
Updated: December 26 2025
View all
Created by

I am a business analyst with a development background, dedicated to helping small businesses and entrepreneurs leverage cloud services for increased efficiency. My expertise lies in automating manual workflows, integrating data from multiple cloud service providers, creating insightful dashboards, and building custom CRM systems.

Featured*