Skip to main content

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

Workflow preview

Workflow preview
100%
Generate content ideas from social trends with Apify, Gemini, and Google Sheets preview
Open on n8n.io

1. Workflow Overview

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,...

Best for

  • Content Creation automation workflows
  • Multimodal AI automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.httprequest, n8n-nodes-base.set, @n8n/n8n-nodes-langchain.agent, n8n-nodes-base.aggregate, @n8n/n8n-nodes-langchain.outputparserstructured, n8n-nodes-base.googlesheets, n8n-nodes-base.code, n8n-nodes-base.stickynote

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Pratyush Kumar Jha.

Original n8n.io source

1.1 Workflow description

Title
Generate content ideas from social trends with Apify, Gemini, and Google Sheets
Workflow name
Generate content ideas from social trends with Apify, Gemini, and Google Sheets

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.
  1. Edit Fields (Set) Extracts fullText from each scraped item and stores it in a Content field.

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

  3. 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.

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

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

  3. (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)

  • Edit form fields (add author, language, region, or filters).
  • Change webhook behaviour or require authentication.

2. X Scraper (HTTP Request)

  • URL: Change to another Apify act or another scraping API.
  • jsonBody: Change maxItems, sort (Top/Recent), or modify searchTerms (e.g., topic + hashtag).
  • Headers: Set the Authorization: Bearer token (Apify).
  • Add pagination or query parameters if switching scraper APIs.

3. Edit Fields (Set)

  • Map additional fields (author, date, source URL).
  • Add filtering logic (remove short posts, retweets, duplicates).

4. Aggregate

  • Customize aggregation strategy:
  • Concatenate
  • Sample top N
  • Deduplicate before combining

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

  • Edit systemMessage and prompt template (tone, format, extra outputs).
  • Tune LM parameters (temperature, max tokens).
  • Update schema to request:
  • Sentiment
  • Key quotes
  • Additional formats

6. Code in JavaScript

  • Modify formatting (CSV-ready, add timestamp).
  • Add metadata columns.
  • Add deduplication or length checks before write.

7. Append Row in Sheet (Google Sheets)

  • Change spreadsheet ID or sheet name.
  • Add more columns.
  • Switch from Append to Upsert.
  • Configure batch appends.

What You’ll Need (Credentials)

1. Apify API Token

  • Used in the HTTP Request node.
  • Set in header: Authorization: Bearer YOUR_APIFY_TOKEN

2. Google Sheets OAuth2 Credentials

  • Must include spreadsheets scope.
  • Required for appending rows.

3. Google / PaLM / Google Gemini API Credentials

  • Used by the LangChain / Google Gemini node.

Optional

  • n8n webhook URL (for mounting the form).
  • Monitoring credentials (Slack webhook, Sentry, etc.) for alerts.

Recommended Settings & Best Practices

  • Enable workflow only after testing (active: true).
  • Limit maxItems (20–50 recommended).
  • Sanitize & dedupe content before sending to the AI.
  • Always use a Structured Output Parser for reliable JSON.
  • Set low temperature (0.0–0.6) for consistent results.
  • Add retries and exponential backoff for external APIs.
  • Add logging or Slack alerts for failures.
  • Keep execution log columns in the sheet (status, error_message, run_time).
  • Store workflow JSON in version control.
  • Monitor API rate limits (Apify + Google).
  • Avoid writing scraped PII into public sheets.

Customization Ideas

  • Add output types:

  • Instagram captions

  • LinkedIn posts

  • Video scripts

  • Email subject lines

  • Add sentiment / trend scoring.

  • Add language detection & translation.

  • Store aggregated content in a vector database (Pinecone / Chroma).

  • Schedule runs using Cron trigger.

  • Add multiple data sources (Reddit, RSS, HackerNews).

  • Add approval workflow (Slack / Notion).

  • Add metadata columns:

  • source_urls

  • top_authors

  • most_shared


Tags

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

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - X Scraper

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 2 - Edit Fields

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 3 - AI Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 2.2

Block 4 - Aggregate

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

Block 5 - Structured Output Parser

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.3

Block 6 - Append row in sheet

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.7

Block 7 - Code in JavaScript

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 8 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - On form submission

Type / Role
n8n-nodes-base.formTrigger - formTrigger
Config choices
Version 2.3

Block 10 - Google Gemini Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - lmChatGoogleGemini
Config choices
Version 1

Block 11 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 12 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 13 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Generate content ideas from social trends with Apify, Gemini, and Google Sheets
Complexity intermediate
Nodes 13
Categories Content Creation, Multimodal AI
Author Pratyush Kumar Jha
Published 19 Feb 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/13525/13525.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Generate content ideas from social trends with Apify, Gemini, and Google Sheets do?

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,...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Content Creation, Multimodal AI use case.