n8n

How to Automate YouTube Trend Research?

Get a chat assistant that finds fresh YouTube videos for a specific niche and returns the best options with clear stats. It helps creators and marketing teams plan content faster and pick ideas with more confidence.

A chat message triggers an AI Agent with short term memory. The agent checks if the user gave a niche. If not, it asks for one. When a niche is provided, it runs a YouTube search tool that looks for recent videos from the last two days in the US. Results go through a loop to enrich each video with details like duration and metrics using the YouTube API. A filter keeps only items that meet length rules. Cleaned and grouped data gets saved and sent back as a single response.

You will need an OpenAI API key, a YouTube OAuth connection, and a Google Cloud API key with the YouTube Data API enabled. Set the GOOGLE_API_KEY environment variable in n8n Cloud. Expect research time to drop from hours to minutes while keeping results consistent. This fits channels, agencies, and brands that track niche trends often. Adjust region, safe search, and date filters to match your audience and goals.

What are the key features?

  • Chat webhook trigger captures user requests in real time
  • AI Agent verifies the niche and asks for it if missing
  • OpenAI chat model with a memory window for short context
  • Tool workflow runs a YouTube search with a strict input schema
  • YouTube node pulls up to three recent videos with safe search and US region
  • Batch loop enriches each video with duration and stats from the YouTube API
  • Conditional step filters out items that fail the length rule
  • Code nodes clean text and store the final group in static memory

What are the benefits?

  • Reduce manual research from 2 hours to 5 minutes
  • Automate 80% of searching and filtering work
  • Improve selection accuracy by removing copy paste errors
  • Connect OpenAI and YouTube data in one place
  • Keep focus on videos published in the last 48 hours

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with OpenAI, YouTube Data API and Google Cloud. See the Tools Required section above for links to create accounts with these services.
  3. In the n8n credentials manager, open the OpenAI credential used by the chat model or create a new one. Paste your OpenAI API key and save.
  4. Double click the YouTube node. In the Credential to connect with dropdown, click Create new credential and follow the on screen steps to connect your YouTube account with OAuth2. Approve the requested scopes.
  5. In Google Cloud, enable the YouTube Data API v3 for your project and create an API key. In n8n Cloud settings, add an environment variable named GOOGLE_API_KEY with that key and restart the instance if required.
  6. Open the YouTube search node and confirm settings: query uses the search_term input, region is US, publishedAfter is the last two days, order is relevance, and safe search is moderate.
  7. Check the HTTP Request node for the YouTube videos endpoint. Make sure query parameters include key set to the GOOGLE_API_KEY, id mapped from the video item, and part set to contentDetails, snippet, statistics.
  8. Execute the workflow and copy the production URL from the chat trigger. Send a POST with a message that includes your niche, or use the built in test to chat and ask for trending videos.
  9. Review the execution. Verify that the loop, filter, and code nodes output grouped results. Confirm the final response field contains the curated list.
  10. If no items return, widen the date range, change region, or check quota in Google Cloud. If authentication fails, reauthorize YouTube OAuth or update the OpenAI key.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

Google Cloud

Sign up

Always Free (Cloud Storage): $0 / mo — 5 GB-months regional storage (us-east1, us-west1, us-central1), 5,000 Class A ops, 50,000 Class B ops, 100 GB egress from North America / mo

OpenAI

Sign up

Pay-as-you-go: GPT-5 at $1.25 per 1M input tokens and $10 per 1M output tokens

YouTube Data API

Sign up

Free: $0, default 10,000 units/day per project; additional quota via audit request (no paid tier)

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.