AutomationFlowsAI & RAG › Generate & Schedule Social Posts with Gemini/openai for X and Linkedin

Generate & Schedule Social Posts with Gemini/openai for X and Linkedin

ByNurseflow @nurseflowio on n8n.io

How it works: This end-to-end workflow automates your personal or brand content strategy by: 🧠 Using Google Gemini or OpenAI to generate engaging LinkedIn/X content from a title or trending posts. 🗓️ Posting directly to LinkedIn and X (formerly Twitter). 📊 Pulling…

Event trigger★★★★☆ complexityAI-powered14 nodesGoogle Gemini ChatForm TriggerAgentOutput Parser StructuredTwitterLinkedInFormHTTP Request
AI & RAG Trigger: Event Nodes: 14 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #5913 — we link there as the canonical source.

This workflow follows the Agent → Form recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "2MkrpeTUd7VHfSS9",
  "name": "Linkedin content machine",
  "tags": [],
  "nodes": [
    {
      "id": "5b1cc120-3c02-46b4-bfc7-bdc9e9ae363d",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -980,
        80
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash"
      },
      "typeVersion": 1
    },
    {
      "id": "b7447847-28bc-4ee3-9518-46dc3210268b",
      "name": "Receive Post Title",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -1180,
        -140
      ],
      "parameters": {
        "options": {},
        "formTitle": "post",
        "formFields": {
          "values": [
            {
              "fieldLabel": "post title"
            }
          ]
        },
        "authentication": "basicAuth",
        "formDescription": "post"
      },
      "typeVersion": 2.2
    },
    {
      "id": "9b52651d-ab43-429a-9176-56ed29afee35",
      "name": "Generate AI Content",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -980,
        -140
      ],
      "parameters": {
        "text": "=\nwrite min 50 word about this topic '{{ $json[\"post title\"] }}'\nfor Linkedin and X platform separately",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.7
    },
    {
      "id": "f363dad1-532e-423d-b0ff-1f4ffa48dd9e",
      "name": "Format AI Output",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -820,
        120
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"event_name\": {\n      \"type\": \"string\"\n    },\n    \"event_description\": {\n      \"type\": \"string\"\n    },\n    \"platform_posts\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"LinkedIn\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"post\": {\n              \"type\": \"string\"\n            },\n            \"hashtags\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"call_to_action\": {\n              \"type\": \"string\"\n            }\n          }\n        },\n        \"Twitter\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"post\": {\n              \"type\": \"string\"\n            },\n            \"hashtags\": {\n              \"type\": \"array\",\n              \"items\": {\n                \"type\": \"string\"\n              }\n            },\n            \"character_limit\": {\n              \"type\": \"integer\"\n            }\n          }\n        }\n      }\n    },\n    \"additional_notes\": {\n      \"type\": \"string\"\n    }\n  }\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "e8fd6a4f-9448-4c76-96b0-895d6fc0b30c",
      "name": "Post to X",
      "type": "n8n-nodes-base.twitter",
      "position": [
        -600,
        -240
      ],
      "parameters": {
        "text": "={{ $json.output.platform_posts.Twitter.post }}",
        "additionalFields": {}
      },
      "typeVersion": 2
    },
    {
      "id": "2f73b732-c9db-4ee8-8d58-38c4cbb562ec",
      "name": "Post to LinkedIn",
      "type": "n8n-nodes-base.linkedIn",
      "position": [
        -600,
        -20
      ],
      "parameters": {
        "text": "={{ $json.output.platform_posts.LinkedIn.post }}",
        "person": "-HtNhNKSsE",
        "additionalFields": {}
      },
      "typeVersion": 1
    },
    {
      "id": "14220250-98e1-4c4e-84d8-8dedc9dc3532",
      "name": "Append Linkedin And X Publishing Responses",
      "type": "n8n-nodes-base.merge",
      "position": [
        -320,
        -120
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineAll"
      },
      "typeVersion": 3
    },
    {
      "id": "351351dd-da19-421c-8a94-dc7687a05097",
      "name": "Show Confirmation",
      "type": "n8n-nodes-base.form",
      "position": [
        -100,
        -120
      ],
      "parameters": {
        "options": {},
        "operation": "completion",
        "completionTitle": "Your post has been successfully shared",
        "completionMessage": "=\ud83d\udd17 View your posts:\n\nX (Twitter): \n[https://x.com/x/status/{{ $json.id }}]\n\nLinkedIn:\n[https://www.linkedin.com/feed/update/{{ $json.urn }}]"
      },
      "typeVersion": 1
    },
    {
      "id": "2a1b857a-cc59-4662-806b-d74d0416d2e5",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1120,
        520
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "38e09681-ab07-4479-b5fb-b66af78f72d8",
      "name": "Fetch LinkedIn Posts",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -880,
        520
      ],
      "parameters": {
        "url": "https://api.apify.com/v2/actor-tasks/your-task-YOUR_OPENAI_KEY_HERE/runs/last/dataset/items?token=YOUR_TOKEN_HERE",
        "options": {},
        "jsonParameters": true
      },
      "typeVersion": 1
    },
    {
      "id": "9d9af28f-82d8-484d-a4da-b24076861b90",
      "name": "Filter High Engagement Posts",
      "type": "n8n-nodes-base.function",
      "position": [
        -660,
        520
      ],
      "parameters": {
        "functionCode": "return items.filter(item => item.json.engagement && item.json.engagement.likes > 10);"
      },
      "typeVersion": 1
    },
    {
      "id": "108bf9c2-cbed-4d38-b9ce-8a88bab7f782",
      "name": "Generate Post Ideas (OpenAI)",
      "type": "n8n-nodes-base.openAi",
      "position": [
        -460,
        520
      ],
      "parameters": {
        "model": "gpt-4o-mini",
        "options": {},
        "requestOptions": {}
      },
      "typeVersion": 1
    },
    {
      "id": "9acab2bf-974f-432c-8dd0-3fcd78bd5f31",
      "name": "Save Drafts to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -260,
        520
      ],
      "parameters": {
        "range": "Sheet1!A:B",
        "options": {},
        "sheetId": "YOUR_GOOGLE_SHEET_ID",
        "operation": "append"
      },
      "typeVersion": 1
    },
    {
      "id": "9326e33a-24d1-4b49-bb60-fa40fefaf0b9",
      "name": "Notify Reviewer (Slack)",
      "type": "n8n-nodes-base.slack",
      "position": [
        -60,
        520
      ],
      "parameters": {
        "text": "New LinkedIn post ideas are ready for review:\n\n{{$json[\"choices\"][0].message.content}}",
        "channel": "YOUR_SLACK_CHANNEL",
        "attachments": [],
        "otherOptions": {}
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "d8bd4e59-84a9-4e7d-bdae-557a8056ad95",
  "connections": {
    "Post to X": {
      "main": [
        [
          {
            "node": "Append Linkedin And X Publishing Responses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format AI Output": {
      "ai_outputParser": [
        [
          {
            "node": "Generate AI Content",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Post to LinkedIn": {
      "main": [
        [
          {
            "node": "Append Linkedin And X Publishing Responses",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Fetch LinkedIn Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Receive Post Title": {
      "main": [
        [
          {
            "node": "Generate AI Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate AI Content": {
      "main": [
        [
          {
            "node": "Post to X",
            "type": "main",
            "index": 0
          },
          {
            "node": "Post to LinkedIn",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch LinkedIn Posts": {
      "main": [
        [
          {
            "node": "Filter High Engagement Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate AI Content",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Filter High Engagement Posts": {
      "main": [
        [
          {
            "node": "Generate Post Ideas (OpenAI)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Post Ideas (OpenAI)": {
      "main": [
        [
          {
            "node": "Save Drafts to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Drafts to Google Sheets": {
      "main": [
        [
          {
            "node": "Notify Reviewer (Slack)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append Linkedin And X Publishing Responses": {
      "main": [
        [
          {
            "node": "Show Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

How it works: This end-to-end workflow automates your personal or brand content strategy by: 🧠 Using Google Gemini or OpenAI to generate engaging LinkedIn/X content from a title or trending posts. 🗓️ Posting directly to LinkedIn and X (formerly Twitter). 📊 Pulling…

Source: https://n8n.io/workflows/5913/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

🎯 Create viral TikToks, Shorts, Reels, podcasts, and ASMR videos in minutes — all on autopilot.

OpenAI, HTTP Request, Form Trigger +7
AI & RAG

How it Works

Memory Buffer Window, Agent, Output Parser Structured +9
AI & RAG

This automation is designed to help you generate AI-powered music tracks, cover art, and fully rendered music videos — all triggered from a simple Telegram chat and managed via Google Sheets.

OpenAI Chat, Memory Buffer Window, Output Parser Structured +11
AI & RAG

This workflow is designed for marketers, content creators, agencies, and solo founders who want to publish long‑form posts with visuals on autopilot using n8n and AI agents. ​

Tool Http Request, Agent, HTTP Request +27
AI & RAG

🧠 Automate end-to-end SEO blog creation and WordPress publishing using a GPT-5 multi-agent workflow with real-time research, metadata generation, and optional featured images.

Output Parser Structured, HTTP Request, OpenAI +10