HomeAI AutomationHow to Build an AI Content…
AI Automation

How to Build an AI Content Factory with n8n (Google Trends to Blog, Instagram & TikTok)

How to Build an AI Content Factory with n8n (Google Trends to Blog, Instagram & TikTok)

Chasing trends is exhausting. You’re scrolling Google Trends hoping something resonates, sketching outlines, writing blog posts, designing graphics, scripting videos—all for three different platforms. By the time you publish, the trend’s already fading. What if your entire content machine ran itself? Every 8 hours, a workflow discovers the hottest trending topic, generates a polished 3000-word blog outline, a 5-slide Instagram carousel concept, and a 60-second TikTok script—then sends them to you for a single-click approval. That’s the power of an AI Content Factory built with n8n, OpenAI, and Slack.

Ready to automate your content creation pipeline? Get the complete workflow template to start building.

What You’ll Build

This workflow transforms you from a content creator into a content director. Here’s the five-step experience:

  1. Trend discovery runs automatically — Every 8 hours, the system fetches the US Google Trends RSS feed and identifies the single most viral topic using AI analysis.
  2. Three AI agents work in parallel — A blog writer generates a 3000-word SEO outline with proper heading hierarchy, an Instagram designer dreams up a 5-slide carousel concept, and a TikTok writer scripts a punchy 60-second video hook.
  3. Content is reviewed via Slack — A beautifully formatted message arrives in your Slack channel with preview text and one-click Approve/Reject buttons.
  4. You approve or reject instantly — No need to touch n8n. Just click in Slack, and the workflow reacts in real time.
  5. Approved content lands in Google Sheets — All three content pieces (blog, Instagram, TikTok) save to a spreadsheet you can export, edit, or feed into your publishing tools.

How It Works — The Big Picture

Here’s the complete flow, from trend detection to Sheets:

┌─────────────────────────────────────────────────────────────┐
│  Schedule Trigger (Every 8 hours)                           │
└────────────────────┬────────────────────────────────────────┘
                     │
┌────────────────────v────────────────────────────────────────┐
│  Config Node (Google Trends URL, Slack channel)             │
└────────────────────┬────────────────────────────────────────┘
                     │
┌────────────────────v────────────────────────────────────────┐
│  HTTP Request → Google Trends Daily RSS Feed (US)           │
└────────────────────┬────────────────────────────────────────┘
                     │
┌────────────────────v────────────────────────────────────────┐
│  AI Agent: Trend Filter (GPT-4o-mini)                       │
│  → Selects 1 viral topic + reason + target audience         │
│  → Returns JSON with structured output                      │
└────────────┬──────────────────────────────────────┬─────────┘
             │                                      │
    ┌────────v────────┐         ┌─────────────────v────────┐
    │ AI Agent:       │         │ AI Agent:                 │
    │ Blog Writer     │         │ Instagram Designer        │
    │ (GPT-4o-mini)   │         │ (GPT-4o-mini)             │
    │ → 3K word SEO   │         │ → 5-slide carousel        │
    │   outline       │         │   concept                 │
    └────────┬────────┘         └────────────┬──────────────┘
             │                               │
             │      ┌──────────────────┐    │
             │      │ AI Agent:        │    │
             │      │ TikTok Script    │    │
             │      │ (GPT-4o-mini)    │    │
             │      │ → 60-sec script  │    │
             │      └────────┬─────────┘    │
             └──────────┬────────────────────┘
                        │
        ┌───────────────v────────────────┐
        │  Merge (3 inputs)              │
        │  Combine all 3 AI outputs      │
        └───────────────┬────────────────┘
                        │
        ┌───────────────v────────────────┐
        │  Code Node (JavaScript)        │
        │  Sanitize text + structure     │
        │  → blog_content                │
        │  → instagram_content           │
        │  → tiktok_script               │
        └───────────────┬────────────────┘
                        │
        ┌───────────────v────────────────┐
        │  Slack Message (Block Kit)     │
        │  Send Approve/Reject buttons   │
        └───────────────┬────────────────┘
                        │
        ┌───────────────v────────────────┐
        │  Wait for Webhook Callback     │
        │  Pause until user clicks       │
        └───────────────┬────────────────┘
                        │
        ┌───────────────v────────────────┐
        │  IF: query.action === approve? │
        └───┬──────────────────────────┬─┘
    YES │                              │ NO
        │                         (End)│
    ┌───v─────────────────────────────┘
    │
    │  Google Sheets Append
    │  → blog_content, instagram_content,
    │    tiktok_script (3 columns)
    │  ✓ Content saved
  

What You’ll Need

Before you start, gather these pieces:

  • n8n instance — Free cloud at n8n.cloud or self-hosted
  • OpenAI API key — GPT-4o-mini model access (budget ~$0.20–$0.50 per workflow run)
  • Slack workspace — With bot token (scopes: chat:write, incoming-webhook)
  • Google Sheets — One sheet with 3 columns: blog_content, instagram_content, tiktok_script
  • Google Trends RSS URL — US daily trends: https://trends.google.com/trends/trendingsearches/daily/rss?geo=US
  • Time — ~45 minutes to set up (most time spent configuring credentials)

Part 1 — Trend Discovery

1 Schedule Trigger

Start with a Schedule Trigger node set to repeat every 8 hours. This ensures your content factory runs throughout the day—morning, afternoon, evening. Choose a time that fits your workflow; 9 AM, 5 PM, and 1 AM is a solid split.

💡

Pro tip: If you want manual control too, add a Manual trigger in parallel so you can test anytime.

2 Config Node

Next, create a Set node called “Config” to store your constants. This keeps your workflow clean and reusable:

  • google_trends_url = https://trends.google.com/trends/trendingsearches/daily/rss?geo=US
  • slack_channel = #content-approvals
  • slack_bot_token = (your Slack bot token)

Store these as {{ $node["Config"].json.google_trends_url }} when you reference them later. This pattern keeps credentials safe if you share the workflow.

3 HTTP Request — Fetch Google Trends

Add an HTTP Request node with these settings:

  • Method: GET
  • URL: {{ $node["Config"].json.google_trends_url }}
  • Response Format: JSON

Google Trends serves an RSS feed. n8n automatically parses it into JSON. You’ll get back a list of trending topics with titles, descriptions, and images. The structure looks like this:

{
  "rss": {
    "channel": {
      "item": [
        {
          "title": "Climate Crisis 2026",
          "description": "Up 2,100% in the last 24 hours",
          "link": "https://..."
        },
        {
          "title": "AI Robotics Breakthrough",
          "description": "Up 1,850% in the last 24 hours"
        }
        // ... more items
      ]
    }
  }
}

The HTTP Request node extracts these automatically. You’ll reference {{ $node["HTTP Request"].json.rss.channel.item }} in the next step.

4 AI Agent — Trend Filter

Now the AI enters. Create an AI Agent node (OpenAI) that analyzes all trends and picks the single most viral topic. Configure it like this:

  • Model: GPT-4o-mini
  • Prompt:
You are a trend analyst. I've given you a list of today's Google Trends.
Analyze each trend's growth metrics and cultural relevance.
Pick THE SINGLE most viral topic that will appeal to a broad creator audience.
Return a JSON object with exactly these fields:
{
  "selected_topic": "exact trend title",
  "reason": "2-sentence explanation of why this trend is viral",
  "target_audience": "who should care about this (e.g., Gen Z, fitness enthusiasts)"
}

Set Structured Output Parser to JSON mode. Pass in {{ $node["HTTP Request"].json.rss.channel.item }} as the input data. The AI Agent will return structured JSON like:

{
  "selected_topic": "AI-Powered Fitness Wearables",
  "reason": "Up 2,340% in last 24h. Combines AI hype + health trend + consumer gadgets.",
  "target_audience": "Tech enthusiasts, fitness influencers, early adopters"
}

Part 2 — Parallel Content Generation

Now that you have the viral topic, three AI agents run simultaneously to create content for different platforms. This is where n8n’s parallel execution shines.

5 AI Agent — Blog Writer

Add an AI Agent node called “Blog Writer” with this prompt:

You are an expert SEO content strategist. I need a 3000-word blog post outline
on this topic: "{{ $node["Trend Filter"].json.selected_topic }}"

Create a comprehensive outline with:
- H1: Catchy main title
- H2 sections (5–7 main sections)
- H3 subsections under each H2
- 2–3 bullet points under each H3
- Include an intro section, an FAQ section, and a CTA section

Target audience: {{ $node["Trend Filter"].json.target_audience }}

Output as plain text outline (not HTML).

Model: GPT-4o-mini. This generates a roadmap for writers or AI-to-content pipelines. The output is ready to feed to a blog post writer or expanded into full prose.

6 AI Agent — Instagram Designer

Add another AI Agent called “Instagram Designer” with this prompt:

You are a social media content strategist specializing in Instagram.
Create a 5-slide carousel concept for this trending topic: "{{ $node["Trend Filter"].json.selected_topic }}"

Slide breakdown:
- Slide 1 (Cover): Eye-catching headline + hook
- Slides 2-4 (Info): Key insights, stats, or benefits (one concept per slide)
- Slide 5 (CTA): Call-to-action (link bio, DM for more, etc.)

For each slide, write:
1. Text copy (max 150 chars per slide)
2. Visual concept (describe the design, colors, layout)
3. Recommended hashtags

Target audience: {{ $node["Trend Filter"].json.target_audience }}

Output as plain text instructions for a designer or content creator.

The AI creates a blueprint that you or a designer can use to create the actual carousel graphics.

7 AI Agent — TikTok Script Writer

Create a third AI Agent called “TikTok Script Writer”:

You are a TikTok content strategist. Write a 60-second TikTok script on this topic:
"{{ $node["Trend Filter"].json.selected_topic }}"

Script structure:
- Hook (0–3 seconds): Stop-the-scroll opener
- Body (3–50 seconds): Main content, insights, or entertainment
- CTA (50–60 seconds): What viewers should do next

Include:
- [Action] or [Visual] cues in brackets
- Pacing notes (fast cuts, slow reveals, etc.)
- Suggested audio vibe (upbeat, educational, etc.)

Target audience: {{ $node["Trend Filter"].json.target_audience }}

Output as plain text script with brackets for visual cues.

Position all three AI agents in parallel—they don’t depend on each other, so n8n runs them simultaneously. This saves ~45 seconds per workflow run.

Part 3 — Review & Approval

8 Merge Node

After the three AI agents finish, add a Merge node to combine their outputs. Set it to merge “3 into 1 row” to bundle the data:

  • Input 1: Blog Writer AI output
  • Input 2: Instagram Designer AI output
  • Input 3: TikTok Script Writer AI output

The Merge node creates a single data object with all three content pieces.

9 Code Node — Sanitize & Structure

Add a Code node (JavaScript) to clean up the text and create a final data structure:

// Sanitize helper: remove extra whitespace, HTML entities
const sanitize = (str) => {
  return str.trim().replace(/"/g, '"').replace(/&/g, '&').slice(0, 5000);
};

// Extract content from merged inputs
const blogContent = sanitize($('Blog Writer').json.text || '');
const instagramContent = sanitize($('Instagram Designer').json.text || '');
const tiktokScript = sanitize($('TikTok Script Writer').json.text || '');

return {
  blog_content: blogContent,
  instagram_content: instagramContent,
  tiktok_script: tiktokScript,
  topic: $('Trend Filter').json.selected_topic,
  timestamp: new Date().toISOString()
};

This node outputs a clean, validated JSON object ready for Slack and Google Sheets.

10 Slack — Send Approval Message

Add a Slack node to post a beautifully formatted message with Approve/Reject buttons. Use Block Kit format:

{
  "channel": "#content-approvals",
  "blocks": [
    {
      "type": "header",
      "text": {
        "type": "plain_text",
        "text": "New Trending Content Ready for Review"
      }
    },
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "*Topic:* {{ $node["Code"].json.topic }}\n*Generated:* {{ $node["Code"].json.timestamp }}"
      }
    },
    {
      "type": "divider"
    },
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "*Blog Outline Preview:*\n```{{ $node["Code"].json.blog_content.slice(0, 300) }}...```"
      }
    },
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "*Instagram Carousel:*\n```{{ $node["Code"].json.instagram_content.slice(0, 300) }}...```"
      }
    },
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "*TikTok Script:*\n```{{ $node["Code"].json.tiktok_script.slice(0, 300) }}...```"
      }
    },
    {
      "type": "actions",
      "elements": [
        {
          "type": "button",
          "text": {
            "type": "plain_text",
            "text": "Approve"
          },
          "style": "primary",
          "action_id": "approve_btn"
        },
        {
          "type": "button",
          "text": {
            "type": "plain_text",
            "text": "Reject"
          },
          "style": "danger",
          "action_id": "reject_btn"
        }
      ]
    }
  ]
}

11 Wait for Webhook

Add a Wait node and set it to “Receive Webhook Data.” This pauses the workflow until someone clicks a button in Slack. Configure the webhook to listen for responses with a unique identifier so n8n knows which workflow instance to resume.

12 IF Node — Check Approval

Add an IF node to evaluate the button click:

  • Condition: {{ $json.action_id }} === "approve_btn"
  • True path: Proceed to Google Sheets (next step)
  • False path: End workflow (Reject path)

13 Google Sheets — Append Content

On the True path, add a Google Sheets node to append a row with your three content pieces:

  • Operation: Append Row
  • Range: Sheet1!A:C (columns A, B, C)
  • Values:
[
  "{{ $node['Code'].json.blog_content }}",
  "{{ $node['Code'].json.instagram_content }}",
  "{{ $node['Code'].json.tiktok_script }}"
]

Each approval adds a new row to your sheet. Your Sheets file becomes a living archive of all generated content.

The Data Structure

Here’s what your Google Sheets looks like after a few approvals:

blog_content instagram_content tiktok_script
H1: AI Fitness Wearables Explained
H2: Why Wearables Matter
H3: Real-time Health Monitoring…
Slide 1: “AI wearables are here 🤖”
Slide 2: “Track your heart rate live”
Slide 3: “Predict health trends”…
[Fast cut] “Your fitness watch just got smarter!”
[Slow reveal] Shows wearable features
[Hook] “Link in bio for the best AI tracker”
H1: The Viral Pet Trend of 2026
H2: Why Pets Rule Social Media
H3: TikTok’s Pet Algorithm…
Slide 1: “Your pet could be famous 🐾”
Slide 2: “Pet content gets 10x engagement”
Slide 3: “Three tips for viral pet videos”…
[Upbeat music] Show cute pet moment
[Voiceover] “This got 5M views…”
[CTA] “Film your pet today!”
H1: Micro-Learning Apps Changing Education
H2: The Attention Economy
H3: 5-minute Learning Sessions…
Slide 1: “Learn anything in 5 minutes”
Slide 2: “Education goes mobile”
Slide 3: “Apps making it happen”…
[Montage] Quick lesson clips
[Stats] “1M students downloaded this week”
[CTA] “Join the learning revolution”

Full System Flow Diagram

Here’s the complete end-to-end picture:

START
  │
  ├─→ [Schedule: Every 8h]
  │
  ├─→ [Config: Trends URL, Slack channel]
  │
  ├─→ [HTTP: Fetch Google Trends RSS]
  │
  ├─→ [AI: Trend Filter (Pick 1 topic)]
  │    └─→ { selected_topic, reason, audience }
  │
  ├─→ [PARALLEL BRANCH]
  │   ├─→ [AI: Blog Writer]
  │   │   └─→ 3000-word SEO outline
  │   │
  │   ├─→ [AI: Instagram Designer]
  │   │   └─→ 5-slide carousel concept
  │   │
  │   ├─→ [AI: TikTok Script Writer]
  │   │   └─→ 60-second script
  │
  ├─→ [Merge: Combine 3 outputs]
  │
  ├─→ [Code: Sanitize & structure]
  │
  ├─→ [Slack: Send Approve/Reject message]
  │
  ├─→ [Wait: Listen for webhook callback]
  │
  ├─→ [IF: query.action === "approve"?]
  │   ├─ YES: Google Sheets Append → DONE
  │   └─ NO: END (Rejected)
  │
END
  

Testing Your Workflow

Test Plan

  1. Test each node individually. Use the “Test” button in n8n to run HTTP Request in isolation. Verify you get valid RSS data.
  2. Test the Trend Filter AI Agent. Mock some sample trend data and confirm it picks one topic and returns valid JSON.
  3. Test the parallel AI agents. Run Blog Writer, Instagram Designer, and TikTok Script Writer on a sample topic. Check the quality of outputs.
  4. Test the Code node. Verify it sanitizes text and structures the final JSON correctly.
  5. Test Slack integration. Send a test Block Kit message to your #content-approvals channel. Verify the layout and buttons.
  6. Test the full workflow. Trigger manually, approve in Slack, and confirm the row appears in Google Sheets within 30 seconds.

Troubleshooting

Problem Cause Solution
HTTP Request returns empty data RSS feed URL changed or is blocked Test URL directly in browser. Check if Google Trends blocks n8n IPs. Use a proxy if needed.
AI Agent returns invalid JSON Prompt unclear or model tier too low Clarify prompt with JSON example. Use GPT-4o instead of -mini for complex tasks.
Slack message doesn’t appear Bot token missing scopes or channel misspelled Verify bot has chat:write and incoming-webhook scopes. Double-check channel name (#content-approvals).
Wait node times out after 24h Slack button click not sent to webhook Verify webhook URL is correct in Slack integration. Test with manual webhook trigger first.
Google Sheets append fails Columns A, B, C don’t exist or are protected Create three blank columns in Sheet1. Ensure service account has editor access. Check range is Sheet1!A:C.

Frequently Asked Questions

How much does this cost to run?

Each workflow run consumes ~$0.20–$0.50 in OpenAI API credits (for GPT-4o-mini’s 3 concurrent calls). Running every 8 hours = ~$1.50–$3.75 per day, or ~$45–$115 per month. n8n cloud is free up to 1,000 executions/month. Slack and Google Sheets are free for basic use.

Can I change the frequency? What if I want content every 4 hours?

Yes. Edit the Schedule Trigger to repeat every 4 hours. You’ll generate more content but consume 2x the OpenAI credits. For budget-conscious users, 8–12 hours is ideal. For agencies, 4 hours keeps content ultra-fresh.

What if I want to filter trends by category (e.g., only tech or health)?

Modify the Trend Filter AI Agent prompt to include a category constraint. Example: “Pick the most viral tech topic” or “Pick the most viral health/fitness trend.” You can also use multiple RSS feeds (Google Trends has different regional and category feeds) and use n8n’s Switch node to route to different workflows.

Can I store approvals and rejections in Google Sheets?

Absolutely. Add a second Google Sheets node in the Reject path (the False branch of the IF node) that appends to a different sheet (e.g., “Rejected Content”) with a reason field or rejection timestamp. This gives you a complete audit trail.

How do I handle multiple trends? Can the workflow pick the top 3?

Yes. Modify the Trend Filter AI Agent to return an array of 3 topics instead of 1. Then use a Loop node to iterate over the 3 topics and spawn 3 parallel content-generation sub-workflows. You’ll end up with more content but 3x the API cost. Great for high-volume content factories.

Ready to Launch Your AI Content Factory?

Stop manually hunting trends and scripting videos. Get the complete, production-ready n8n workflow template and start automating your content pipeline in minutes. Includes pre-configured nodes, all prompts, and Slack integration.

Get the Workflow Template

Includes setup guide, testing checklist, and 30-day support.

What’s Next?

You’ve built a lean, mean content machine. Here are four directions to expand:

  1. Add LinkedIn content generation. Duplicate the Blog Writer AI Agent, adjust the prompt to LinkedIn voice (professional, conversational), and add LinkedIn as a fourth platform in the Merge node. Your workflow now outputs blog, Instagram, TikTok, and LinkedIn posts simultaneously.
  2. Store full blog posts, not outlines. Replace the Blog Writer AI Agent with a more powerful model (GPT-4o) and ask it to generate the full 3000-word blog post with HTML tags. Append the HTML directly to a “Published Content” sheet or send to your WordPress site via REST API.
  3. Add image generation. After the Instagram Designer AI Agent, pipe the carousel concept to DALL-E 3 to auto-generate actual carousel images. The Slack message can preview real images instead of text concepts.
  4. Build a content calendar dashboard. Connect your Google Sheets to a tool like Airtable or a custom web dashboard. View all pending, approved, and published content in one place. Add filters by topic, platform, and date.

n8n
Google Trends
OpenAI
Slack
Google Sheets
automation
content marketing