Analyze YouTube channel performance with Telegram, Google Sheets, and Gemini

Go to Workflow
0 views
Built by iamvaar iamvaar
Created on August 20, 2026

Description

Quick overview
Youtube Video: https://youtu.be/0YnI_8VsRe8?si=OLPAo4YOFSyfwCv9

This workflow listens for YouTube channel link sent to a Telegram bot, pulls channel and latest upload metrics from the YouTube Data API, computes velocity and baseline benchmarks, logs a snapshot to Sheets, and generates a structured report using Gemini that it replies with in Telegram.

How it works
Triggers when a new Telegram message arrives and extracts a YouTube channel ID or @handle from the text.
Validates the link format and replies in Telegram with usage instructions if no channel identifier is found.
Calls the YouTube Data API to resolve the channel details and replies in Telegram if the channel is not found or if the API call fails.
Fetches the channel’s uploads playlist and retrieves the latest 20 uploads, then batches a YouTube Data API request to get each video’s stats and metadata.
Calculates per-video metrics (such as views per hour, age, duration, chapters, and engagement per 1,000 views), ranks videos by velocity, and computes baseline and “fingerprint” benchmarks (cadence, format splits, title patterns, and trend).
If there are fewer than five videos older than 48 hours, sends a “no baseline” message in Telegram; otherwise, appends a snapshot row to Google Sheets.
Sends the computed metrics to Google Gemini to write a five-section analysis and posts the final channel report back to Telegram.

Setup
Create a Telegram bot, add your Telegram credentials in n8n, and enable the Telegram Trigger webhook for the workflow.
Add YouTube Data API credentials (API key via HTTP Query Auth) and ensure the key has access to the YouTube Data API v3.
Add Google Gemini (Google PaLM) API credentials and keep the model set to models/gemini-3.1-flash-lite.
Add a Google Sheets service account credential, share the target spreadsheet with the service account email, and set the document ID and tab for the snapshot log.
Replace the placeholder webhook IDs and any placeholder Sheet IDs/URLs in the workflow with your environment’s actual values.

Nodes Used (5)

Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm
Google Gemini Chat Model
@n8n/n8n-nodes-langchain.lmChatGoogleGemini
Google Sheets
n8n-nodes-base.googleSheets
HTTP Request
n8n-nodes-base.httpRequest
Telegram
n8n-nodes-base.telegram