🎬 Generate content ideas from social trends with Apify, Gemini, and Google Sheets

⚑ 105 views · 🎬 Content Creation & Video

πŸ’‘ Pro Tip β€” HTTP Request scraping tends to break when sites update their markup. If you’re scraping a major platform, check if ScraperNode covers it β€” it has maintained scrapers for LinkedIn, Instagram, TikTok, YouTube, and 20+ other platforms that return structured data.

View All Scrapers

Description

Trend2Content

This n8n workflow (named Trend2Content) takes a short topic input from a small web form, scrapes recent/top social content for that topic (via an Apify act), aggregates the raw text, passes that aggregated content into a LangChain AI agent (Google Gemini in this flow) which returns a structured content output (topic summary, blog post title ideas, tweet hooks), formats that output, and appends the results into a Google Sheet.

It’s a lightweight:

Topic β†’ Trending Content β†’ AI Ideas β†’ Sheet

pipeline for fast content ideation.


How It Works (Step-by-Step)

  1. On Form Submission
    The user fills a single field Topic (webhook/form trigger).

  2. X Scraper (HTTP Request)
    Calls an Apify act run-sync-get-dataset-items with:

    • searchTerms: [{{ $json.Topic }}]
    • maxItems: 20
      to fetch social posts for that topic.
  3. Edit Fields (Set)
    Extracts fullText from each scraped item and stores it in a Content field.

  4. Aggregate
    Aggregates the Content field so the AI agent receives one combined input rather than many separate items.

  5. Google Gemini Chat Model (LM) + AI Agent (LangChain Agent Node)
    The agent uses a templated system prompt + the aggregated content to generate a structured response with:

    • Topic summary
    • Blog title ideas
    • Tweet hooks

    The agent is connected to a Structured Output Parser node to force a predictable JSON schema.

  6. Code in JavaScript
    Transforms the structured JSON into sheet-friendly strings (joins arrays with bullets).

  7. Append Row in Sheet (Google Sheets)
    Appends the generated blog_post_titles and tweet_hooks to the target Google Sheet.

  8. (Optional)
    Sticky notes and internal meta nodes exist for documentation and board organization.


Quick Setup Guide

πŸ‘‰ Demo & Setup Video πŸ‘‰ Sheet Template πŸ‘‰ Course


Nodes of Interest You Can Edit

1. On Form Submission (formTrigger)

2. X Scraper (HTTP Request)

3. Edit Fields (Set)

4. Aggregate

5. Google Gemini Chat Model / AI Agent / Structured Output Parser

6. Code in JavaScript

7. Append Row in Sheet (Google Sheets)


What You’ll Need (Credentials)

1. Apify API Token

2. Google Sheets OAuth2 Credentials

3. Google / PaLM / Google Gemini API Credentials

Optional



Customization Ideas


Tags

#content-ideation’
#social
#ai
#google-gemini
#apify
#google-sheets
#n8n

πŸ”— Nodes Used

Google Sheets, HTTP Request, AI Agent, Structured Output Parser, n8n Form Trigger, Google Gemini Chat Model

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup