Skip to main content

Twitter content automation with Gemini AI for tweets, images, and engagement

Workflow preview

Workflow preview
100%
Twitter content automation with Gemini AI for tweets, images, and engagement preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

N8N Workflow AI Powered Twitter Automation with Content Generation and Engagement This n8n template automates Twitter (X) activity — from generating tweet content with AI to engaging with po...

Best for

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

Tools used

n8n-nodes-base.formtrigger, n8n-nodes-base.set, n8n-nodes-base.twittertool, @n8n/n8n-nodes-langchain.agent, n8n-nodes-base.code, n8n-nodes-base.httprequest, @n8n/n8n-nodes-langchain.lmchatgooglegemini, n8n-nodes-base.twitter

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Twitter content automation with Gemini AI for tweets, images, and engagement
Workflow name
Twitter content automation with Gemini AI for tweets, images, and engagement

## | N8N Workflow | AI-Powered Twitter Automation with Content Generation and Engagement 🚀

This n8n template automates Twitter (X) activity — from generating tweet content with AI to engaging with posts and even sending DMs — all powered by Google Gemini or OpenRouter AI.

It’s designed for creators, marketers, brands, and agencies who want to automate social media presence with authentic, on-brand AI content and engagement.

How It Works

  • The workflow begins with a form trigger, where users input their topic, tone, and action type (Tweet, Engage, or DM).
  • Those inputs are passed into Workflow Configuration, which sets key parameters like max tweet length and model URLs. Depending on your chosen action:
  • Post Tweet: AI generates a tweet under 280 characters and can attach an image.
  • Engage with Posts: AI can like, retweet, or reply to niche-relevant content.
  • Send Direct Message: AI drafts a personalized DM for outreach or networking.
  • If your workflow includes visuals, the AI Agent - Create Image From Prompt node builds a detailed image prompt (based on your topic and instructions) and sends it to Google Gemini or other image APIs.
  • The HTTP Request - Create Image node generates a custom image via an external model (default: Pollinations.ai).
  • Finally, all tweet text and image data merge together in Merge Tweet Text and Image, before being posted directly via the Create Tweet node.

How To Use

  • Download and Import the JSON workflow into your n8n interface.
  • Set up the following credentials:
  • OpenRouter API for text generation.
  • Google Gemini (PaLM) for chat and image prompt creation.
  • Twitter OAuth2 API for posting and engagement actions.
  • Configure your form input fields (Topic, Tone, Action, Instructions).

Enable or disable the nodes you want:

  • Create Tweet → To post automatically.
  • Twitter Engagement Tool → For likes/retweets/replies.
  • Twitter DM Tool → For automated DMs.
  • Trigger the Twitter Content Form via n8n’s web interface.
  • Enter your content preferences and submit.
  • The workflow generates your tweet text, optionally creates a matching image, and posts or saves it automatically.

Requirements

A Twitter Developer Account (with OAuth2 credentials). A Google Gemini or OpenRouter account with text and image model access. (Optional) Connection to Pollinations or another AI image generation API.

How To Customize

  • Update “Fields – Set Values” node to change:
  • Default image size (1080 × 1920 px).
  • Model name (e.g., “flux”, “turbo”, “kontext”).
  • Modify Workflow Configuration to tweak AI parameters like:
  • imageGenerationChance (default: 0.3).
  • maxTweetLength (default: 280).
  • Replace Google Gemini Chat Model with any supported model such as OpenAI GPT-4 or Mistral.
  • Adjust AI Agent - Create Image From Prompt system message for your preferred image style or guidelines.
  • Toggle which Twitter actions are active — Post, Engage, or DM — to tailor automation to your goals.

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 - Twitter Content Form

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

Block 2 - Workflow Configuration

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

Block 3 - Twitter Post Tool

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

Block 4 - Twitter DM Tool

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

Block 5 - Twitter AI Agent

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

Block 6 - Process AI Response

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

Block 7 - Fields - Set Values

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

Block 8 - Code - Clean Json

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

Block 9 - Code - Get Prompt

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

Block 10 - HTTP Request - Create Image

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

Block 11 - Code - Set Filename

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

Block 12 - AI Agent - Create Image From Prompt

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

Block 13 - Google Gemini Chat Model2

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

Block 14 - Twitter Engagement Tool

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

Block 15 - Create Tweet

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

Block 16 - Merge Tweet Text and Image

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

Block 17 - Google Gemini Chat Model3

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

Block 18 - Sticky Note6

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

Block 19 - Sticky – Twitter Form

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

Block 20 - Sticky – Twitter AI

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

Block 21 - Sticky – Image Gen Flow

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

Block 22 - Sticky – Twitter Actions

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

Block 23 - Sticky – Credentials

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

Block 24 - Sticky – Merge & Tweet

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

3. Summary Table

Workflow Twitter content automation with Gemini AI for tweets, images, and engagement
Complexity advanced
Nodes 24
Categories Social Media, Multimodal AI
Author Kamran habib
Published 30 Oct 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/10322/10322.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 Twitter content automation with Gemini AI for tweets, images, and engagement do?

N8N Workflow AI Powered Twitter Automation with Content Generation and Engagement This n8n template automates Twitter (X) activity — from generating tweet content with AI to engaging with po...

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.