AutomationFlowsAI & RAG › Auto-generate AI Videos and Publish to Youtube with Gemini, Kie AI & Blotato

Auto-generate AI Videos and Publish to Youtube with Gemini, Kie AI & Blotato

ByAmit Kumar @amitxd on n8n.io

This workflow is ideal for YouTube creators, automation builders, and marketers who want to produce short AI-generated videos automatically. It’s especially useful for channels that publish frequent Shorts-style content or want to automate the entire video creation and posting…

Cron / scheduled trigger★★★★☆ complexityAI-powered15 nodesGoogle Gemini ChatOutput Parser StructuredHTTP Request@Blotato/N8N Nodes BlotatoAgent
AI & RAG Trigger: Cron / scheduled Nodes: 15 Complexity: ★★★★☆ AI nodes: yes Added:

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

This workflow follows the Agent → HTTP Request 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
{
  "name": "Auto-Generate AI Videos and Publish to YouTube with Gemini, KIE AI & Blotato",
  "tags": [],
  "nodes": [
    {
      "id": "a1829fb3-e609-4d38-b033-a02fb0c086c2",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        544,
        176
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 12
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "2f51a6bb-8432-4634-a47a-a132ee826687",
      "name": "Code in JavaScript",
      "type": "n8n-nodes-base.code",
      "position": [
        704,
        176
      ],
      "parameters": {
        "jsCode": "// Generate a random number between 1 and 7\nconst randomNumber = Math.floor(Math.random() * 7) + 1;\n\nreturn {\n  json: {\n    randomNumber\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "ddcc1241-a966-4c5c-8736-3a14c6dcd2f0",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        592,
        352
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "99310464-4432-443b-9a13-34cccae71504",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        768,
        368
      ],
      "parameters": {
        "autoFix": true,
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"title\": { \"type\": \"string\" },\n    \"description\": { \"type\": \"string\" },\n    \"prompt\": { \"type\": \"string\" }\n  },\n  \"required\": [\"title\", \"description\", \"prompt\"],\n  \"additionalProperties\": false\n}\n"
      },
      "typeVersion": 1.3
    },
    {
      "id": "412e7813-022c-4d98-bace-ec842779b13c",
      "name": "Create video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1232,
        240
      ],
      "parameters": {
        "url": "https://api.kie.ai/api/v1/jobs/createTask",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"sora-2-text-to-video\",\n  \"callBackUrl\": \"https://example.com/callback\",\n  \"input\": {\n    \"prompt\": \"{{ $json.output.prompt }}\",\n    \"aspect_ratio\": \"portrait\",\n    \"n_frames\": \"10\",\n    \"remove_watermark\": true\n  }\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "typeVersion": 4.3
    },
    {
      "id": "8c078a27-2396-4ade-ad82-748df1238257",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        1392,
        240
      ],
      "parameters": {
        "amount": 400
      },
      "typeVersion": 1.1
    },
    {
      "id": "9bb2a4b7-dbd3-47ed-b45b-4244a2156359",
      "name": "Get Video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1552,
        240
      ],
      "parameters": {
        "url": "https://api.kie.ai/api/v1/jobs/recordInfo",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "taskId",
              "value": "={{ $json.data.taskId }}"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "664e9d73-efc1-4d71-8180-99a5e1d3bb95",
      "name": "Upload media",
      "type": "@blotato/n8n-nodes-blotato.blotato",
      "position": [
        1776,
        240
      ],
      "parameters": {
        "mediaUrl": "={{ JSON.parse($json.data.resultJson).resultUrls[0] }}",
        "resource": "media"
      },
      "typeVersion": 2
    },
    {
      "id": "e8f8b6e7-21f4-4db4-8ea0-b90deb6d3457",
      "name": "Create post",
      "type": "@blotato/n8n-nodes-blotato.blotato",
      "position": [
        1968,
        240
      ],
      "parameters": {
        "options": {},
        "platform": "youtube",
        "accountId": "YOUR_BLOTATO_ACCOUNT_ID",
        "postContentText": "={{ $('Prompter').item.json.output.description }}",
        "postContentMediaUrls": "={{ $json.url }}",
        "postCreateYoutubeOptionTitle": "={{ $('Prompter').item.json.output.title }}",
        "postCreateYoutubeOptionContainsSyntheticMedia": true
      },
      "typeVersion": 2
    },
    {
      "id": "9e53eb13-6cde-4e90-9858-38627bea3e0f",
      "name": "Prompter",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        864,
        176
      ],
      "parameters": {
        "text": "=Generate a (title, description, and prompt) for template number: {{ $json.randomNumber }}. \nReturn only valid minified JSON that matches the required schema.\n",
        "options": {
          "systemMessage": "You are an AI that generates random video prompts..."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "f164141a-1167-42a2-81be-d48599815bb3",
      "name": "Sticky Note - Community Warning2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1184,
        96
      ],
      "parameters": {
        "color": 7,
        "width": 536,
        "height": 312,
        "content": "## Video Generator\nSends the generated prompt to KIE AI for rendering. The workflow waits during processing and then retrieves the final video URL once the video has finished rendering.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "4487e4e8-b4b3-4d1a-8425-a81d4966f5cd",
      "name": "Sticky Note - Community Warning3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        32
      ],
      "parameters": {
        "color": 7,
        "width": 578,
        "height": 444,
        "content": "## Script Builder\nGenerates the video title, description, and prompt. The scheduler triggers execution, a random template is selected, and Gemini returns structured JSON that follows the defined schema.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "b437b406-93c2-414e-8418-1a2d2310145f",
      "name": "Sticky Note - Community Warning1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1744,
        112
      ],
      "parameters": {
        "color": 7,
        "width": 420,
        "height": 292,
        "content": "## Auto-Publisher (YouTube)\nUploads the rendered video to Blotato and publishes it automatically to your connected YouTube channel. Make sure to replace the Blotato account ID before running.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d7214883-510b-4cc8-b57b-2449da56e682",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 450,
        "height": 520,
        "content": "## Overview\n\nThis workflow automatically generates short AI-powered videos and publishes them directly to YouTube on a recurring schedule. It brings together Google Gemini for creating the script, KIE AI for rendering the video, and Blotato for uploading and publishing. It is ideal for creators, marketers, automation builders, and YouTube automation channels that want consistent video output without manual editing or production work.\n\n## How It Works\n\nThe scheduler triggers the workflow at a set interval. A random template number is selected, and Gemini generates a structured title, description, and video prompt. KIE AI converts the prompt into a rendered video. Once processing is complete, the workflow retrieves the final media URL, uploads the video through Blotato, and publishes it automatically to your connected YouTube channel.\n\n## Requirements\n\n\u2022 Google Gemini API key\n\u2022 KIE AI API key\n\u2022 Blotato account with YouTube connected\n\u2022 Self-hosted n8n instance (community nodes required)\n\n## Setup\n\nAdd your API credentials to the appropriate nodes, replace the Blotato account ID, and adjust video settings such as aspect ratio, watermark removal, or frame count. Once configuration is complete, activate the workflow to start automated, recurring video generation.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "a6f2215f-3901-4eb6-a022-be2787d2ec97",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1216,
        576
      ],
      "parameters": {
        "color": 7,
        "width": 288,
        "content": "## Before running:\n\u2022 Add API keys  \n\u2022 Set Blotato account ID  \n\u2022 Adjust video settings (optional)\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "",
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Get Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prompter": {
      "main": [
        [
          {
            "node": "Create video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Video": {
      "main": [
        [
          {
            "node": "Upload media",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create video": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload media": {
      "main": [
        [
          {
            "node": "Create post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Prompter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Prompter",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Structured Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Prompter",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

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

About this workflow

This workflow is ideal for YouTube creators, automation builders, and marketers who want to produce short AI-generated videos automatically. It’s especially useful for channels that publish frequent Shorts-style content or want to automate the entire video creation and posting…

Source: https://n8n.io/workflows/10859/ — 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 workflow automatically creates short-form AI videos using Sora 2 Cameos, powered by n8n and AI agents.

@Apify/N8N Nodes Apify, Google Sheets, Google Gemini +6
AI & RAG

Automatically generate viral short-form health videos using AI and publish them to social platforms with n8n and Veo 3. This workflow collects viral ideas, analyzes engagement patterns, generates AI v

@Apify/N8N Nodes Apify, Google Sheets, Google Gemini +6
AI & RAG

Overview

Google Gemini Chat, Tool Think, Output Parser Structured +6
AI & RAG

Automatically generate AI avatar short videos and publish them to social platforms using n8n and HeyGen. This workflow turns viral ideas or prepared scripts into fully rendered AI avatar videos and ha

Google Gemini Chat, Google Sheets, @Apify/N8N Nodes Apify +5
AI & RAG

This n8n template automates the entire process of generating short-form AI videos and publishing them across multiple social media platforms. It combines Google Gemini for structured prompt creation,

Agent, Google Gemini Chat, Output Parser Structured +2