Skip to main content

Generate trending X, Facebook, and Threads posts with Apify, Gemini, and Buffer

Workflow preview

Workflow preview
100%
Generate trending X, Facebook, and Threads posts with Apify, Gemini, and Buffer preview
Open on n8n.io

1. Workflow Overview

Overview This workflow automatically discovers trending topics, generates engaging social media content using AI, and publishes posts to X (Twitter) and Facebook via Buffer. It combines trend mo...

Best for

  • Social Media automation workflows
  • Multimodal AI automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.datatable, n8n-nodes-base.code, @n8n/n8n-nodes-langchain.googlegemini, @n8n/n8n-nodes-langchain.mcpclient, n8n-nodes-base.splitinbatches, n8n-nodes-base.noop, @apify/n8n-nodes-apify.apify, n8n-nodes-base.scheduletrigger

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Afigo Sam.

Original n8n.io source

1.1 Workflow description

Title
Generate trending X, Facebook, and Threads posts with Apify, Gemini, and Buffer
Workflow name
Generate trending X, Facebook, and Threads posts with Apify, Gemini, and Buffer

🚀 Overview

This workflow automatically discovers trending topics, generates engaging social media content using AI, and publishes posts to X (Twitter) and Facebook via Buffer.

It combines trend monitoring + AI content generation + automated publishing into one seamless pipeline, helping creators and marketers stay consistent and relevant without manual effort.

🎯 Who is this for

  • Content creators & social media managers
  • Agencies managing multiple accounts
  • Developers building AI-powered automation systems
  • Anyone who wants to post consistently on trending topics

⚙️ What this workflow does

  1. Fetches trending topics (e.g., from X or external sources)
  2. Filters and formats relevant trends
  3. Uses Google Gemini to generate:
  4. X (Twitter) tweets
  5. Facebook posts
  6. Thread posts
  7. Formats content for each platform
  8. Publishes posts automatically via Buffer API

✨ Key Features

  • Fully automated content pipeline
  • Multi-platform posting (X + Facebook + Thread)
  • AI-generated threads + captions
  • Easily customizable prompts and filters
  • Scalable for multiple niches or accounts

🔧 Setup Instructions

  1. Credentials required
  • Google Gemini API key
  • Apify API key
  • Buffer API access token
  1. Configuration steps
  • Add your API credentials to the respective nodes
  • Customize the prompt templates for your niche
  • Define your preferred trend source or keywords
  • Set posting frequency (via Cron or trigger node)
  1. Optional customization
  • Add moderation/approval step before posting
  • Filter trends by region, hashtags, or keywords
  • Adjust tone (professional, funny, viral, etc.) and language

🧠 How it works (high-level)

The workflow monitors trending data, processes it into structured input, and feeds it into AI models to generate platform-specific content. The output is then formatted and sent to Buffer for scheduled or immediate publishing.

⚠️ Notes & Limitations

  • AI-generated content may require review for accuracy
  • Rate limits may apply depending on APIs used
  • Ensure Buffer supports your connected accounts
  • Trending data source reliability may vary

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 - Create a data table

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1.1

Block 2 - Filter Last 24h

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

Block 3 - Remove Used Trends

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

Block 4 - Pick Trend

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

Block 5 - trend

Type / Role
@n8n/n8n-nodes-langchain.googleGemini - googleGemini
Config choices
Version 1.1

Block 6 - Post only tweets

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

Block 7 - Get Used Trends

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1.1

Block 8 - Insert row

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1.1

Block 9 - Code in JavaScript1

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

Block 10 - Loop Over Items

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 11 - Replace Me

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

Block 12 - Run an Actor and get dataset1

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

Block 13 - Schedule Trigger1

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.3

Block 14 - Get Daily x trends1

Type / Role
@n8n/n8n-nodes-langchain.googleGemini - googleGemini
Config choices
Version 1.1

Block 15 - Run an Actor and get dataset2

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

Block 16 - Extract Trends3

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

Block 17 - If3

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

Block 18 - Extract Trends4

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

Block 19 - Extract Trends5

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

Block 20 - If4

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

Block 21 - Split Trend

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

Block 22 - Split Trend Apify

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

Block 23 - Split Trend1

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 24 - facebook post

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

Showing the first 24 of 39 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Generate trending X, Facebook, and Threads posts with Apify, Gemini, and Buffer
Complexity advanced
Nodes 39
Categories Social Media, Multimodal AI
Author Afigo Sam
Published 09 Apr 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/14961/14961.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 trending X, Facebook, and Threads posts with Apify, Gemini, and Buffer do?

Overview This workflow automatically discovers trending topics, generates engaging social media content using AI, and publishes posts to X (Twitter) and Facebook via Buffer. It combines trend mo...

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 Social Media, Multimodal AI use case.