AutomationFlowsAI & RAG › AI Content Post Generation with Gemini & OpenAI

AI Content Post Generation with Gemini & OpenAI

Original n8n title: AI Content Post Generation

AI Content Post Generation. Uses googleGeminiChatModel, openAi. Webhook trigger; 8 nodes.

Webhook trigger★★★★☆ complexityAI-powered8 nodesGoogle Gemini Chat ModelOpenAI
AI & RAG Trigger: Webhook Nodes: 8 Complexity: ★★★★☆ AI nodes: yes Added:

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
{
  "name": "AI Content Post Generation",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "generate-posts",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "webhook-postgen",
      "name": "Webhook (Post Generation)",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "summary",
              "value": "={{ $node[\\\"Webhook (Post Generation)\\\"].json[\\\"summary\\\"] }}"
            },
            {
              "name": "platforms",
              "value": "={{ $node[\\\"Webhook (Post Generation)\\\"].json[\\\"platforms\\\"] }}"
            },
            {
              "name": "style",
              "value": "={{ $node[\\\"Webhook (Post Generation)\\\"].json[\\\"user_style\\\"] || \\\"professional\\\" }}"
            },
            {
              "name": "focus",
              "value": "={{ $node[\\\"Webhook (Post Generation)\\\"].json[\\\"user_focus\\\"] || \\\"general\\\" }}"
            },
            {
              "name": "brand",
              "value": "={{ $node[\\\"Webhook (Post Generation)\\\"].json[\\\"brand_info\\\"] }}"
            }
          ]
        },
        "options": {}
      },
      "id": "set-input-data",
      "name": "Set Input Data",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.2,
      "position": [
        480,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "// Loop through platforms and create content for each\\nconst platforms = $node[\\\"Set Input Data\\\"].json[\\\"platforms\\\"];\\nconst summary = $node[\\\"Set Input Data\\\"].json[\\\"summary\\\"];\\nconst style = $node[\\\"Set Input Data\\\"].json[\\\"style\\\"];\\nconst focus = $node[\\\"Set Input Data\\\"].json[\\\"focus\\\"];\\nconst brand = $node[\\\"Set Input Data\\\"].json[\\\"brand\\\"];\\n\\nconst results = [];\\n\\nfor (const platform of platforms) {\\n  results.push({\\n    json: {\\n      platform: platform,\\n      summary: summary,\\n      style: style,\\n      focus: focus,\\n      brand: brand\\n    }\\n  });\\n}\\n\\nreturn results;"
      },
      "id": "split-platforms",
      "name": "Split Platforms",
      "type": "n8n-nodes-base.code",
      "typeVersion": 3,
      "position": [
        720,
        300
      ]
    },
    {
      "parameters": {
        "model": "gemini-1.5-flash",
        "messages": [
          {
            "role": "user",
            "content": "Generate a social media post for {{$node[\\\"Split Platforms\\\"].json[\\\"platform\\\"]}} based on this summary: {{$node[\\\"Split Platforms\\\"].json[\\\"summary\\\"]}}\\n\\nStyle: {{$node[\\\"Split Platforms\\\"].json[\\\"style\\\"]}}\\nFocus: {{$node[\\\"Split Platforms\\\"].json[\\\"focus\\\"]}}\\n{{#if $node[\\\"Split Platforms\\\"].json[\\\"brand\\\"]}}Brand: {{$node[\\\"Split Platforms\\\"].json[\\\"brand\\\"]}}\\n{{/if}}\\n\\nMake it engaging and appropriate for the platform. Return just the post content."
          }
        ],
        "options": {}
      },
      "id": "gemini-post-text",
      "name": "Gemini (Post Text)",
      "type": "n8n-nodes-base.googleGeminiChatModel",
      "typeVersion": 1,
      "position": [
        960,
        300
      ],
      "credentials": {
        "googleGeminiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": "gemini-1.5-flash",
        "messages": [
          {
            "role": "user",
            "content": "Generate an image description for {{$node[\\\"Gemini (Post Text)\\\"].json[\\\"platform\\\"]}} social media post. \\n\\nPost Content: {{$node[\\\"Gemini (Post Text)\\\"].json[\\\"messages\\\"][0][\\\"content\\\"]}}\\n\\nSummary: {{$node[\\\"Gemini (Post Text)\\\"].json[\\\"summary\\\"]}}\\n\\nCreate a detailed prompt for DALL-E or similar AI image generator. Make it visually appealing and relevant to the post content."
          }
        ],
        "options": {}
      },
      "id": "gemini-image-prompt",
      "name": "Gemini (Image Prompt)",
      "type": "n8n-nodes-base.googleGeminiChatModel",
      "typeVersion": 1,
      "position": [
        1200,
        300
      ],
      "credentials": {
        "googleGeminiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "image",
        "operation": "generate",
        "size": "1024x1024",
        "model": "dall-e-3",
        "prompt": "={{ $node[\\\"Gemini (Image Prompt)\\\"].json[\\\"messages\\\"][0][\\\"content\\\"] }}",
        "options": {}
      },
      "id": "openai-image-gen",
      "name": "OpenAI Image Generation",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "position": [
        1440,
        300
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "post_text",
              "value": "={{ $node[\\\"Gemini (Post Text)\\\"].json[\\\"messages\\\"][0][\\\"content\\\"] }}"
            },
            {
              "name": "image_prompt",
              "value": "={{ $node[\\\"Gemini (Image Prompt)\\\"].json[\\\"messages\\\"][0][\\\"content\\\"] }}"
            },
            {
              "name": "image_url",
              "value": "={{ $node[\\\"OpenAI Image Generation\\\"].json[\\\"data\\\"][0][\\\"url\\\"] }}"
            },
            {
              "name": "platform",
              "value": "={{ $node[\\\"Gemini (Post Text)\\\"].json[\\\"platform\\\"] }}"
            }
          ]
        },
        "options": {
          "dotNotation": false
        }
      },
      "id": "format-platform-content",
      "name": "Format Platform Content",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.2,
      "position": [
        1680,
        300
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ $node[\\\"Format Platform Content\\\"].json }}"
      },
      "id": "respond-with-posts",
      "name": "Respond with Posts",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        1920,
        300
      ]
    }
  ],
  "connections": {
    "Webhook (Post Generation)": {
      "main": [
        [
          {
            "node": "Set Input Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Input Data": {
      "main": [
        [
          {
            "node": "Split Platforms",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Platforms": {
      "main": [
        [
          {
            "node": "Gemini (Post Text)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini (Post Text)": {
      "main": [
        [
          {
            "node": "Gemini (Image Prompt)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini (Image Prompt)": {
      "main": [
        [
          {
            "node": "OpenAI Image Generation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Image Generation": {
      "main": [
        [
          {
            "node": "Format Platform Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Platform Content": {
      "main": [
        [
          {
            "node": "Respond with Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {},
  "staticData": null
}

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

AI Content Post Generation. Uses googleGeminiChatModel, openAi. Webhook trigger; 8 nodes.

Source: https://github.com/GaneshICOGZ/post-automation/blob/3f72fd08f7c408ae0f312f40116c7c0b645d44fa/n8n/postgen_workflow.json — 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