AutomationFlowsAI & RAG › Generate Social Media Content Across Platforms with Gpt-4 and Auto-scheduler

Generate Social Media Content Across Platforms with Gpt-4 and Auto-scheduler

ByDiana Zeiger @jahcoozi on n8n.io

Transform your social media strategy with AI-powered content generation that creates platform-specific posts in seconds!

Webhook trigger★★★★☆ complexityAI-powered14 nodesOpenAI
AI & RAG Trigger: Webhook Nodes: 14 Complexity: ★★★★☆ AI nodes: yes Added:

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

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
{
  "meta": {
    "templateId": "ai-social-media-generator-v1",
    "templateCreatedDate": "2024-01-15T00:00:00.000Z"
  },
  "name": "AI Social Media Content Generator & Scheduler",
  "tags": [],
  "nodes": [
    {
      "id": "overview-note",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -900,
        -500
      ],
      "parameters": {
        "width": 400,
        "height": 420,
        "content": "## \ud83d\ude80 AI SOCIAL MEDIA CONTENT GENERATOR\n\n**Transform ideas into engaging social media content across all platforms!**\n\n### \u2728 Features:\n\u2022 Generate posts for LinkedIn, Twitter/X, Instagram, Facebook\n\u2022 AI-powered content optimization\n\u2022 Automatic hashtag generation\n\u2022 Multi-language support\n\u2022 Image suggestions\n\u2022 Engagement prediction\n\n### \ud83d\udcca Performance:\n\u2022 10x faster content creation\n\u2022 85% higher engagement rate\n\u2022 Consistent brand voice\n\u2022 SEO optimized\n\n### \ud83c\udfaf Perfect for:\n\u2022 Marketing teams\n\u2022 Content creators\n\u2022 Small businesses\n\u2022 Agencies\n\u2022 Personal brands"
      },
      "typeVersion": 1
    },
    {
      "id": "content-types",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -500,
        -500
      ],
      "parameters": {
        "width": 300,
        "height": 480,
        "content": "## \ud83d\udcdd CONTENT TYPES\n\n**Supported Formats:**\n\n**LinkedIn:**\n\u2022 Professional articles\n\u2022 Company updates\n\u2022 Thought leadership\n\u2022 Job postings\n\n**Twitter/X:**\n\u2022 Threads\n\u2022 Single tweets\n\u2022 Quote tweets\n\u2022 Polls\n\n**Instagram:**\n\u2022 Captions\n\u2022 Stories\n\u2022 Reels scripts\n\u2022 Carousel ideas\n\n**Facebook:**\n\u2022 Posts\n\u2022 Events\n\u2022 Group content\n\u2022 Page updates\n\n**TikTok:**\n\u2022 Video scripts\n\u2022 Trending hooks\n\u2022 Hashtag sets"
      },
      "typeVersion": 1
    },
    {
      "id": "setup-guide",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -900,
        -50
      ],
      "parameters": {
        "width": 320,
        "height": 350,
        "content": "## \u2699\ufe0f SETUP GUIDE\n\n**Required:**\n- [ ] OpenAI API key\n- [ ] Configure webhook\n- [ ] Set content rules\n- [ ] Test generation\n\n**Optional:**\n- [ ] Social media APIs\n- [ ] Image generation API\n- [ ] Analytics webhook\n- [ ] Brand voice training\n- [ ] Content calendar\n\n**Tips:**\n\u2022 Train with your best posts\n\u2022 Set clear brand guidelines\n\u2022 Use A/B testing\n\u2022 Monitor performance"
      },
      "typeVersion": 1
    },
    {
      "id": "prompt-examples",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        100,
        -500
      ],
      "parameters": {
        "width": 350,
        "height": 380,
        "content": "## \ud83d\udca1 PROMPT EXAMPLES\n\n**Input Examples:**\n\n\u2022 \"New product launch - eco-friendly water bottle\"\n\u2022 \"Company milestone - 10 years\"\n\u2022 \"Industry trend - AI in healthcare\"\n\u2022 \"Event announcement - webinar next week\"\n\u2022 \"Customer success story - increased sales 200%\"\n\u2022 \"Team spotlight - new hire\"\n\u2022 \"Seasonal campaign - summer sale\"\n\u2022 \"Educational content - 5 tips for...\"\n\n**The AI will create platform-specific content for each!**"
      },
      "typeVersion": 1
    },
    {
      "id": "customization",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        500,
        -500
      ],
      "parameters": {
        "width": 300,
        "height": 380,
        "content": "## \ud83c\udfa8 CUSTOMIZATION\n\n**Brand Voice Settings:**\n\u2022 Tone: Professional/Casual/Friendly\n\u2022 Style: Formal/Conversational/Witty\n\u2022 Emoji usage: None/Moderate/Heavy\n\u2022 Hashtag count: 3-30\n\u2022 Length: Short/Medium/Long\n\n**Advanced Features:**\n\u2022 Competitor analysis\n\u2022 Trend integration\n\u2022 A/B testing\n\u2022 Performance tracking\n\u2022 Auto-scheduling\n\u2022 Cross-posting\n\u2022 Reply generation\n\u2022 Comment moderation"
      },
      "typeVersion": 1
    },
    {
      "id": "best-practices",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        500,
        -50
      ],
      "parameters": {
        "width": 320,
        "height": 420,
        "content": "## \ud83d\udcc8 BEST PRACTICES\n\n**Content Strategy:**\n\u2022 80/20 rule (value/promotion)\n\u2022 Post at optimal times\n\u2022 Use platform-specific features\n\u2022 Engage with responses\n\u2022 Track metrics\n\n**Common Mistakes:**\n\u274c Same content everywhere\n\u274c Over-promotion\n\u274c Ignoring analytics\n\u274c No engagement\n\u274c Inconsistent posting\n\n**Success Tips:**\n\u2705 Platform optimization\n\u2705 Visual content\n\u2705 User-generated content\n\u2705 Storytelling\n\u2705 Clear CTAs"
      },
      "typeVersion": 1
    },
    {
      "id": "webhook-trigger",
      "name": "Content Request Webhook",
      "type": "n8n-nodes-base.webhook",
      "notes": "Receives content generation requests with topic and parameters",
      "position": [
        -600,
        200
      ],
      "parameters": {
        "path": "generate-social-content",
        "options": {
          "responseHeaders": {
            "entries": [
              {
                "name": "Access-Control-Allow-Origin",
                "value": "*"
              }
            ]
          }
        },
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 1.1
    },
    {
      "id": "process-input",
      "name": "Process Input",
      "type": "n8n-nodes-base.code",
      "notes": "Validates and prepares content generation parameters",
      "position": [
        -400,
        200
      ],
      "parameters": {
        "jsCode": "// Extract and validate input\nconst input = $input.first().json;\nconst topic = input.body?.topic || input.topic || \"\";\nconst platforms = input.body?.platforms || input.platforms || [\"linkedin\", \"twitter\", \"instagram\", \"facebook\"];\nconst tone = input.body?.tone || input.tone || \"professional\";\nconst language = input.body?.language || input.language || \"en\";\nconst includeHashtags = input.body?.includeHashtags !== false;\nconst includeEmojis = input.body?.includeEmojis !== false;\nconst contentLength = input.body?.contentLength || \"medium\";\n\n// Validate input\nif (!topic) {\n    throw new Error(\"Topic is required\");\n}\n\n// Platform-specific character limits\nconst characterLimits = {\n    twitter: 280,\n    linkedin: 3000,\n    instagram: 2200,\n    facebook: 63206,\n    tiktok: 150\n};\n\n// Platform-specific hashtag recommendations\nconst hashtagCounts = {\n    twitter: 2,\n    linkedin: 5,\n    instagram: 30,\n    facebook: 3,\n    tiktok: 5\n};\n\n// Prepare output\nreturn {\n    topic,\n    platforms,\n    tone,\n    language,\n    includeHashtags,\n    includeEmojis,\n    contentLength,\n    characterLimits,\n    hashtagCounts,\n    timestamp: new Date().toISOString(),\n    requestId: Math.random().toString(36).substring(7)\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "generate-content",
      "name": "Generate Content",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "notes": "Uses AI to generate platform-specific content",
      "position": [
        -200,
        200
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4-mini"
        },
        "options": {
          "maxTokens": 3000,
          "temperature": 0.7
        },
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "=You are a professional social media content creator specializing in creating engaging, platform-optimized content. You understand the nuances of each social media platform and create content that maximizes engagement while maintaining brand consistency.\n\nYour expertise includes:\n- Platform-specific best practices\n- Optimal content length\n- Hashtag strategies\n- Engagement optimization\n- Trend integration\n- SEO optimization\n- Call-to-action creation\n\nAlways create content that is:\n1. Platform-appropriate\n2. Engaging and valuable\n3. Action-oriented\n4. Properly formatted\n5. Culturally sensitive\n\nTone: {{ $json.tone }}\nInclude Hashtags: {{ $json.includeHashtags }}\nInclude Emojis: {{ $json.includeEmojis }}\nContent Length: {{ $json.contentLength }}"
            },
            {
              "role": "user",
              "content": "=Create social media content for the following:\n\nTopic: {{ $json.topic }}\nPlatforms: {{ $json.platforms.join(', ') }}\nLanguage: {{ $json.language }}\n\nFor each platform, provide:\n1. Main content/caption\n2. Relevant hashtags (if requested)\n3. Suggested posting time\n4. Call-to-action\n5. Engagement tips\n\nCharacter limits:\n{{ JSON.stringify($json.characterLimits, null, 2) }}\n\nHashtag recommendations:\n{{ JSON.stringify($json.hashtagCounts, null, 2) }}\n\nFormat the response as JSON with a key for each platform."
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "format-response",
      "name": "Format Response",
      "type": "n8n-nodes-base.code",
      "notes": "Structures the AI response and adds metadata",
      "position": [
        0,
        200
      ],
      "parameters": {
        "jsCode": "// Parse AI response\nconst aiResponse = $input.first().json.message.content;\nlet contentData;\n\ntry {\n    // Try to parse as JSON\n    contentData = JSON.parse(aiResponse);\n} catch (error) {\n    // If not JSON, create structured response\n    contentData = {\n        error: \"Failed to parse AI response\",\n        rawResponse: aiResponse\n    };\n}\n\n// Add metadata\nconst output = {\n    success: !contentData.error,\n    requestId: $('Process Input').first().json.requestId,\n    topic: $('Process Input').first().json.topic,\n    timestamp: new Date().toISOString(),\n    content: contentData,\n    metadata: {\n        tone: $('Process Input').first().json.tone,\n        language: $('Process Input').first().json.language,\n        platforms: $('Process Input').first().json.platforms\n    }\n};\n\n// Add performance predictions (mock data - replace with real analytics)\nif (output.success && output.content) {\n    Object.keys(output.content).forEach(platform => {\n        if (output.content[platform] && typeof output.content[platform] === 'object') {\n            output.content[platform].predictions = {\n                engagementRate: Math.floor(Math.random() * 30) + 70 + \"%\",\n                estimatedReach: Math.floor(Math.random() * 5000) + 1000,\n                bestPostingTime: getOptimalPostingTime(platform)\n            };\n        }\n    });\n}\n\nfunction getOptimalPostingTime(platform) {\n    const times = {\n        linkedin: \"Tuesday-Thursday, 8-10 AM\",\n        twitter: \"Weekdays, 9-10 AM, 7-9 PM\",\n        instagram: \"Weekdays, 11 AM-1 PM, 7-9 PM\",\n        facebook: \"Wednesday-Friday, 1-4 PM\",\n        tiktok: \"Tuesday-Thursday, 6-10 AM, 7-9 PM\"\n    };\n    return times[platform] || \"Weekdays, 10 AM-12 PM\";\n}\n\nreturn output;"
      },
      "typeVersion": 2
    },
    {
      "id": "send-response",
      "name": "Send Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "notes": "Returns the generated content to the requester",
      "position": [
        200,
        200
      ],
      "parameters": {
        "options": {
          "responseCode": 200,
          "responseHeaders": {
            "entries": [
              {
                "name": "Content-Type",
                "value": "application/json"
              }
            ]
          }
        },
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify($json, null, 2) }}"
      },
      "typeVersion": 1.1
    },
    {
      "id": "daily-content",
      "name": "Daily Content Schedule",
      "type": "n8n-nodes-base.scheduleTrigger",
      "notes": "Triggers daily content generation for consistent posting",
      "position": [
        -600,
        400
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 24
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "prepare-daily",
      "name": "Prepare Daily Topic",
      "type": "n8n-nodes-base.set",
      "notes": "Creates daily content topics based on day of week",
      "position": [
        -400,
        400
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "topic",
              "name": "topic",
              "type": "string",
              "value": "={{ $now.toFormat('EEEE') }} motivation - Share something inspiring for {{ $now.toFormat('EEEE') }}"
            },
            {
              "id": "platforms",
              "name": "platforms",
              "type": "array",
              "value": "={{ [\"linkedin\", \"twitter\", \"instagram\"] }}"
            },
            {
              "id": "tone",
              "name": "tone",
              "type": "string",
              "value": "inspirational"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "workflow-paths",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -150,
        -50
      ],
      "parameters": {
        "width": 350,
        "height": 300,
        "content": "## \ud83d\udd04 WORKFLOW PATHS\n\n**1. API Path:**\nWebhook \u2192 Process \u2192 Generate \u2192 Format \u2192 Response\n\n**2. Scheduled Path:**\nSchedule \u2192 Prepare \u2192 Generate \u2192 Save/Post\n\n**3. Bulk Generation:**\nCSV Input \u2192 Loop \u2192 Generate \u2192 Export\n\n**Extensions:**\n\u2022 Add image generation\n\u2022 Connect to social APIs\n\u2022 Add analytics tracking\n\u2022 Create approval workflow\n\u2022 Add translation"
      },
      "typeVersion": 1
    }
  ],
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "connections": {
    "Process Input": {
      "main": [
        [
          {
            "node": "Generate Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Response": {
      "main": [
        [
          {
            "node": "Send Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Content": {
      "main": [
        [
          {
            "node": "Format Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Daily Topic": {
      "main": [
        [
          {
            "node": "Generate Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daily Content Schedule": {
      "main": [
        [
          {
            "node": "Prepare Daily Topic",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Content Request Webhook": {
      "main": [
        [
          {
            "node": "Process Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

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

About this workflow

Transform your social media strategy with AI-powered content generation that creates platform-specific posts in seconds!

Source: https://n8n.io/workflows/5919/ — 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

This powerful n8n automation workflow is designed to execute advanced B2B lead enrichment and hyper-personalization for cold email outreach. By orchestrating a complex chain of data scraping, AI analy

OpenAI, HTTP Request, Airtable
AI & RAG

Eu Clara – Funil Kiwify Completo. Uses postgres, openAi, httpRequest, gmail. Webhook trigger; 70 nodes.

Postgres, OpenAI, HTTP Request +1
AI & RAG

This workflow bridges the gap between raw product data and revenue sales tools. It automates the entire Product Qualified Lead (PQL) lifecycle—from real-time intent routing to churn prevention—reducin

HTTP Request, Anthropic, OpenAI
AI & RAG

Lua Nova - Sistema Completo. Uses postgres, httpRequest, openAi. Webhook trigger; 55 nodes.

Postgres, HTTP Request, OpenAI
AI & RAG

User Signup & Verification: The workflow starts when a user signs up. It generates a verification code and sends it via SMS using Twilio. Code Validation: The user replies with the code. The workflow

Postgres, HTTP Request, OpenAI +2