Schedule and optimize Twitter and LinkedIn posts from Google Sheets with OpenAI GPT-4o-mini
Needs changesWhat this workflow does
This AI workflow has 18 nodes and runs on a schedule (every hour) (plus 1 other trigger). Along the way it connects Google Sheets, OpenAI Chat Model, X (Formerly Twitter) and LinkedIn and 1 more.
How it runs
Trigger: On a schedule (every hour) (plus 1 other trigger).
- Merge: merges the data from its input branches
- Fetch Content Queue (Google Sheets): uses Google Sheets
- Filter Ready Posts (Code): runs custom JavaScript code
- Has Content to Post? (If): checks a condition and branches into true / false
- AI Content Optimizer (AI Agent): runs an AI agent, with model: OpenAI Chat Model
- No Content Response (Edit Fields (Set)): sets 2 fields: message, timestamp
- Parse AI Content (Code): runs custom JavaScript code
- Merge: merges the data from its input branches
- Post to Twitter (X (Formerly Twitter)): uses X (Formerly Twitter)
- Post to LinkedIn (LinkedIn): uses LinkedIn
…plus 5 more steps. See the full node list below.
Services it uses
Other OpenAI + Google Sheets templates (2,011) · Other Google Sheets + Slack templates (1,314) · Other OpenAI + Slack templates (979)
Before you upgrade to n8n 3.0
1 thing in this workflow is removed in n8n 3.0. Fix it before you upgrade:
- AI Agent v1 (old agent modes) in AI Content Optimizer (v1.7): replace with Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.
Rather not rewrite it? Many of these flows can be rebuilt in Make (free plan).
Published 2025 — 19% of 2025 templates need changes for 3.0. See how template age affects 3.0 readiness →
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
| Removed in 3.0 | Replace with |
|---|---|
| AI Agent v1 (old agent modes) AI Content Optimizer (v1.7) | Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent. |
Nodes used (14)
- Schedule Trigger
n8n-nodes-base.scheduleTrigger - Webhook
n8n-nodes-base.webhook - Merge
n8n-nodes-base.merge - Google Sheets
n8n-nodes-base.googleSheets - Code
n8n-nodes-base.code - If
n8n-nodes-base.if - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - AI Agent
@n8n/n8n-nodes-langchain.agent - X (Formerly Twitter)
n8n-nodes-base.twitter - LinkedIn
n8n-nodes-base.linkedIn - Aggregate
n8n-nodes-base.aggregate - Slack
n8n-nodes-base.slack - Edit Fields (Set)
n8n-nodes-base.set - Respond to Webhook
n8n-nodes-base.respondToWebhook
From the author
Schedule and optimize social media posts to Twitter and LinkedIn using AI This workflow automates the entire lifecycle of social media management—from fetching draft content to AI-driven optimization and multi-platform publishing. Who’s it for Social media…