YouTube to Gmail, AI trend reports for marketers
You search YouTube, open 12 tabs, copy a few links into a doc, then guess which videos are actually “breaking out.” It’s slow. And honestly, it’s easy to fool yourself with big view counts that don’t mean much.
Marketing managers feel it when they need fresh angles every week. Content strategists run into it when they’re pitching “what’s trending” with shaky evidence. Founders doing their own marketing get stuck here too. This YouTube trend automation gives you a scored, AI-written report in Gmail so you can pick smarter ideas in minutes.
Below you’ll see how the workflow finds breakout videos by keyword, calculates an Algorithmic Lift Score (a simple “viral potential” signal), and emails a clean summary you can act on.
How This Automation Works
The full n8n workflow, from trigger to final output:
n8n Workflow Template: YouTube to Gmail, AI trend reports for marketers
flowchart LR
subgraph sg0["When clicking ‘Test workflow’ Flow"]
direction LR
n0@{ icon: "mdi:play-circle", form: "rounded", label: "When clicking ‘Test workflow’", pos: "b", h: 48 }
n1["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>CalculateMetrics"]
n2@{ icon: "mdi:robot", form: "rounded", label: "AI Agent", pos: "b", h: 48 }
n3@{ icon: "mdi:wrench", form: "rounded", label: "Think", pos: "b", h: 48 }
n4@{ icon: "mdi:brain", form: "rounded", label: "OpenAI Chat Model", pos: "b", h: 48 }
n5@{ icon: "mdi:cog", form: "rounded", label: "Sort", pos: "b", h: 48 }
n6@{ icon: "mdi:play-circle", form: "rounded", label: "Schedule Trigger", pos: "b", h: 48 }
n7["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>GetChannelInfo"]
n8["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>SearchVideos"]
n9@{ icon: "mdi:swap-vertical", form: "rounded", label: "Split Out1", pos: "b", h: 48 }
n10@{ icon: "mdi:swap-vertical", form: "rounded", label: "Split Out2", pos: "b", h: 48 }
n11["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>GetVidStats"]
n12["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>ChannelInfo"]
n13["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>VidStats"]
n14["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/merge.svg' width='40' height='40' /></div><br/>Merge"]
n15["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>AlgorithmicLiftScore"]
n16@{ icon: "mdi:swap-vertical", form: "rounded", label: "Setup", pos: "b", h: 48 }
n17@{ icon: "mdi:cog", form: "rounded", label: "Remove_Duplicates", pos: "b", h: 48 }
n18@{ icon: "mdi:cog", form: "rounded", label: "Limit", pos: "b", h: 48 }
n19@{ icon: "mdi:cog", form: "rounded", label: "Aggregate", pos: "b", h: 48 }
n20["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/markdown.dark.svg' width='40' height='40' /></div><br/>Markdown"]
n21@{ icon: "mdi:message-outline", form: "rounded", label: "Send_Report", pos: "b", h: 48 }
n5 --> n18
n18 --> n19
n14 --> n17
n16 --> n8
n3 -.-> n2
n2 --> n20
n20 --> n21
n13 --> n14
n19 --> n2
n9 --> n10
n10 --> n7
n10 --> n11
n12 --> n14
n11 --> n13
n8 --> n9
n7 --> n12
n1 --> n15
n6 --> n16
n4 -.-> n2
n17 --> n1
n15 --> n5
n0 --> n16
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n0,n6 trigger
class n2 ai
class n4 aiModel
class n3 ai
class n7,n8,n11 api
class n1,n12,n13,n15 code
classDef customIcon fill:none,stroke:none
class n1,n7,n8,n11,n12,n13,n14,n15,n20 customIcon
The Problem: Trend Research Is Mostly Guesswork
Most “trend research” on YouTube turns into a messy mix of gut feel and vanity metrics. You spot a video with a lot of views, but you don’t know if it’s truly taking off or if the creator’s channel is always that strong. Then you try to compare five creators at once. That’s when the spreadsheet starts. Links get lost, stats change overnight, and your final “insights” are basically a screenshot plus vibes. Meanwhile, you still have to write the recap and send it to the team.
The friction compounds. Here’s where it breaks down.
- You waste about 2 hours per research session jumping between search results, channels, and individual video pages.
- Big channels dominate your shortlist even when smaller channels are the ones showing real breakout velocity.
- Manual copy-paste leads to missing context, like subscriber counts or channel baselines, so your comparisons aren’t fair.
- Your “report” becomes another task, which means it ships late or not at all.
The Solution: Automated YouTube Virality Reports to Gmail
This workflow turns one keyword into a prioritized list of breakout videos, plus an AI summary you can forward instantly. It starts with a trigger (manual or scheduled), then searches YouTube for recent top-performing videos in your chosen timeframe. For every result, it pulls the extra data humans usually skip: detailed video stats and the channel’s baseline (subscribers and overall performance). Next, it calculates an “Algorithmic Lift Score” so you’re not just chasing raw views. Finally, it sends the top videos into an AI agent that writes a clear trend report, converts it into readable HTML, and emails it to you through Gmail.
The workflow kicks off when you run it on demand or on a schedule. Data gets gathered and merged across videos and channels, then ranked by lift score. The final output is a clean email report that highlights patterns, winners, and what’s worth copying (and what isn’t).
What You Get: Automation vs. Results
| What This Workflow Automates | Results You’ll Get |
|---|---|
|
|
Example: What This Looks Like
Say you do YouTube trend research three times a week for one client niche. Manually, you might review 20 videos and 20 channels, spending maybe 5 minutes per pick once you count searching, checking channel size, and copying notes. That’s about 5 hours a week. With this workflow, you set the keyword once, let it collect and score up to 20 candidates, then you read the email with the top 5 and the AI summary in about 10 minutes. You get most of that time back, and the short list is backed by numbers, not hunches.
What You’ll Need
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- YouTube Data API v3 for video and channel metrics.
- Gmail to send the finished report to your inbox.
- OpenAI API key (get it from your OpenAI dashboard).
Skill level: Intermediate. You’ll paste API keys, connect Gmail, and adjust a few parameters like keyword and days-back.
Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).
How It Works
A scheduled run (or manual start) kicks things off. You can trigger it weekly, daily, or whenever you need a fresh scan. The workflow begins by loading your saved parameters like keyword, timeframe, and max results.
YouTube gets searched, then each result is expanded. n8n pulls a list of recent videos for your keyword, splits them into individual items, and extracts the fields needed for follow-up requests.
Channel stats and video stats are collected and combined. Separate API calls grab video metrics (views, likes, comments) and channel context (subscriber count, total views). The workflow merges these into one record per video, removes duplicates, then computes the lift score and sorts by that ranking.
An AI agent writes the report and Gmail delivers it. The top five videos are aggregated into a single prompt, summarized with your OpenAI-connected model, rendered into HTML, then emailed out as a ready-to-read trend briefing.
You can easily modify the keyword and days-back window to fit a product launch, a client niche, or a seasonal campaign. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Manual and Scheduled Triggers
Set up both on-demand and scheduled execution paths to start the workflow.
- Open Manual Start Trigger and leave default settings to enable manual runs.
- Open Scheduled Launch Trigger and set the schedule rule to trigger at Hour
13. - Verify both Manual Start Trigger and Scheduled Launch Trigger connect to Initialize Parameters.
Step 2: Initialize Search Parameters
Define the YouTube query, time window, result limits, and recipient email.
- Open Initialize Parameters and set query to
AIvideo. - Set daysback to
3and maxResult to20. - Set email to your report recipient address.
- Set GoogleAPIkey to your YouTube Data API key (currently blank).
Step 3: Fetch YouTube Video and Channel Data
Pull video search results, then expand and fetch both channel and video statistics.
- Open Search Video Results and confirm the query parameters include key
={{ $('Initialize Parameters').item.json.GoogleAPIkey }}, q={{ $('Initialize Parameters').item.json.query }}, maxResults={{ $('Initialize Parameters').item.json.maxResult }}, and publishedAfter={{ $now.minus({ days: $('Initialize Parameters').item.json.daysback }).toUTC().toISO() }}. - In Expand Items List, set fieldToSplitOut to
itemsand fieldsToInclude tovideoId,channelId, publishedAt,. - In Extract Video Fields, set fieldToSplitOut to
items.snippet.channelIdand fieldsToInclude toitems.snippet.channelId, items.snippet.publishedAt, items.id.videoId. - Extract Video Fields outputs to both Fetch Channel Details and Fetch Video Metrics in parallel.
- In Fetch Channel Details, confirm url is
https://www.googleapis.com/youtube/v3/channels?and query includes id={{ $json['items.snippet.channelId'] }}. - In Fetch Video Metrics, confirm url is
https://www.googleapis.com/youtube/v3/videos?and id is={{ $json['items.id.videoId'] }}.
Step 4: Parse, Merge, and Score Video Performance
Normalize channel/video data, remove duplicates, and compute virality metrics.
- Keep Parse Channel Data as-is to extract channelName, channelID, subscriberCount, and view counts from channel responses.
- Keep Parse Video Stats as-is to map categories and extract ViewCount, likeCount, commentCount, and publishedAt.
- In Combine Channel Video, ensure mode is
combineand fieldsToMatchString ischannelID. - Run Eliminate Duplicates to prevent multiple entries for the same channel/video pair.
- Leave Compute Metrics and Compute Lift Score code blocks unchanged to calculate derived fields like
viewsPerHourandalgorithmicLiftScore. - In Order by Lift, sort by algorithmicLiftScore in
descendingorder. - In Cap Top Results, set maxItems to
5to limit the final selection.
Step 5: Aggregate and Summarize with AI
Aggregate the top results and generate a concise AI summary before formatting the report.
- In Aggregate Records, set aggregate to
aggregateAllItemData. - Open AI Summary Agent and confirm text is set to
=json: {{$('Aggregate Records').item.json.data.toJsonString() }}. - Ensure OpenAI Chat Engine is connected as the language model for AI Summary Agent and uses model
gpt-4o-mini. - Note that Reasoning Tool is an AI tool connected to AI Summary Agent; credentials should be added to OpenAI Chat Engine, not the tool node.
Credential Required: Connect your openAiApi credentials in OpenAI Chat Engine.
Step 6: Format and Send the Email Report
Convert the summary to HTML and email it to the recipient.
- In Render Markdown, set mode to
markdownToHtmland markdown to={{ $json.output }}. - In Dispatch Report Email, set sendTo to
={{$('Initialize Parameters').item.json.email}}. - Set message to
={{ $json.data }}and subject to=Virality analysis of the last {{ $('Initialize Parameters').item.json.daysback }} days for keyword: "{{ $('Initialize Parameters').item.json.query }}".
Credential Required: Connect your gmailOAuth2 credentials in Dispatch Report Email.
Step 7: Test and Activate Your Workflow
Run a full test to validate API calls, scoring, AI summary, and email delivery.
- Click Execute Workflow on Manual Start Trigger to run an end-to-end test.
- Confirm Search Video Results returns items and that Fetch Channel Details and Fetch Video Metrics both receive data in parallel.
- Verify Order by Lift and Cap Top Results produce a shortlist and AI Summary Agent outputs a concise summary.
- Check your inbox for the email sent by Dispatch Report Email with HTML-formatted content.
- When satisfied, toggle the workflow to Active so Scheduled Launch Trigger runs daily at the configured hour.
Common Gotchas
- YouTube Data API credentials can expire or lack the right permissions. If things break, check your Google Cloud Console API key restrictions and that “YouTube Data API v3” is enabled first.
- If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
- Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.
Frequently Asked Questions
About 30 minutes if you already have your API keys.
No. You’ll mainly connect accounts and paste API keys. The only “technical” part is picking a keyword and timeframe that match your niche.
Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in OpenAI API usage costs (usually a few cents per report) and any Google API usage if you hit quota limits.
Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.
Yes, but you’ll want to do it intentionally. Many teams duplicate the workflow and change the values in the “Initialize Parameters” node for each niche. If you prefer one workflow, you can pass a keyword in via Webhook or Telegram, then map it into the same parameters. Common customizations include changing daysback, raising maxResult, and editing the AI Summary Agent prompt so it writes in your house style.
Usually it’s an API key restriction or the YouTube Data API v3 not being enabled in Google Cloud. Regenerate the key, confirm billing/quota status, and update the value in the parameters node. If it fails only sometimes, you may be hitting quota limits when you increase max results or run the workflow too often.
It’s designed to analyze a batch like 20 videos per run and then report on the top 5, but you can raise that as long as your YouTube API quota can handle the extra requests.
For this specific job, n8n is usually the better fit because you need multi-step data collection (video stats plus channel stats), merging, custom scoring, sorting, and then an AI summary. That’s doable in Zapier or Make, but it tends to get expensive and fragile once you add branching and repeated API calls. n8n also gives you the self-host option, which matters if you run this frequently. If you only need a simple “search YouTube and email me links” workflow, the lighter tools can be fine. Talk to an automation expert if you want help choosing.
This is the kind of automation you set up once, then lean on every week. The workflow handles the collecting, scoring, and summarizing so you can focus on picking ideas that will actually land.
Need Help Setting This Up?
Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.