Auto genrate social media post

    Shared 8/7/2025

    393 views

    Visual Workflow

    JSON Code

    {
      "id": "U2KxWeIzSdOzme3A",
      "meta": {
        "instanceId": "dc1cd8064e9dddbe5d67c772e186ad945315e55b76b836f3a981254c68d54a17",
        "templateCredsSetupCompleted": true
      },
      "name": "🔨Social media post",
      "tags": [],
      "nodes": [
        {
          "id": "91610319-919a-4228-ada0-4655fccbe490",
          "name": "Trigger: Telegram Prompt",
          "type": "n8n-nodes-base.telegramTrigger",
          "position": [
            1168,
            -336
          ],
          "webhookId": "3f5195e9-9837-4ad1-a502-aed61a8931ad",
          "parameters": {
            "updates": [
              "message"
            ],
            "additionalFields": {}
          },
          "credentials": {
            "telegramApi": {
              "id": "lF3ysozDsYnjleSa",
              "name": "Telegram account"
            }
          },
          "typeVersion": 1.1
        },
        {
          "id": "cfc7c52a-6938-49db-83d0-b953bafefe87",
          "name": "Extract Prompt & Caption",
          "type": "n8n-nodes-base.code",
          "position": [
            864,
            -96
          ],
          "parameters": {
            "jsCode": "\n  inputText=$input.first().json.message.text;\n  // Remove \"generate video\" prefix (case-insensitive) and trim whitespace\n  const cleaned = inputText.replace(/^generate video/i, '').trim();\n\n  // Split at the first comma only\n  const [videoPrompt, captionIdea] = cleaned.split(/,(.+)/).map(s => s.trim());\n\n  // Return as a JSON object\n  return {\n    videoPrompt,\n    captionIdea\n  };\n"
          },
          "typeVersion": 2
        },
        {
          "id": "4665383a-c2b8-4dc6-a955-52fa8f07d5b8",
          "name": "Transform Prompt for Kling (GPT-4)",
          "type": "@n8n/n8n-nodes-langchain.agent",
          "position": [
            1200,
            -96
          ],
          "parameters": {
            "text": "={{ $json.videoPrompt }}",
            "options": {
              "systemMessage": "=⚙️ System Instructions – AI Agent:\nYou are a prompt optimization assistant for Kling AI, a cutting-edge text-to-video generation platform.\n\n🎯 Mission:\nTransform brief user inputs into cinematic, high-quality video prompts rich in sensory details, spatial context, and dynamic motion—perfectly tuned for Kling AI.\n\n✍️ Instructions:\nExpand short ideas into visually immersive scenes.\n\nUse concrete visual elements: colors, textures, lighting, motion, atmosphere, camera angles.\n\nKeep descriptions concise but vivid, like a scene from a movie script.\n\nOutput only the final prompt—no explanations, no formatting tips.\n\n🌟 Examples:\nUser Input: “Rainy street at night”\nFinal Prompt:\nNeon signs reflect in puddles on a dimly lit city street. Raindrops ripple across a parked motorcycle's chrome. A figure in a trench coat walks past flickering lights as steam rises from a nearby sewer grate. The camera tracks from ground level, capturing water splashing underfoot.\n\nUser Input: “Mountain hike”\nFinal Prompt:\nA hiker climbs a rugged mountain trail at sunrise, golden light hitting snow-capped peaks in the distance. Wind rustles through pine trees as birds soar overhead. The camera pans slowly from behind, revealing a vast valley below bathed in morning mist.\n\nUser Input: “Cozy library”\nFinal Prompt:\nA warm library room with wooden shelves lined with old books. Dust floats in the sunbeams streaming through tall windows. A cat naps on a leather armchair while a hand flips through a weathered novel. The camera gently rotates around the room, revealing small glowing lamps."
            },
            "promptType": "define"
          },
          "typeVersion": 1.8
        },
        {
          "id": "07405d46-02a0-446d-b0e6-593c147f7e7c",
          "name": "OpenAI Model Bridge",
          "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
          "position": [
            1232,
            80
          ],
          "parameters": {
            "model": {
              "__rl": true,
              "mode": "list",
              "value": "gpt-4o-mini"
            },
            "options": {}
          },
          "credentials": {
            "openAiApi": {
              "id": "SUSVT1243CEaMEmc",
              "name": "n8n free OpenAI API credits"
            }
          },
          "typeVersion": 1.2
        },
        {
          "id": "e4cadec8-bc55-4bc1-a4b1-b2aaf73711b4",
          "name": "Generate Video via Kling API",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            1760,
            -240
          ],
          "parameters": {
            "url": "https://api.piapi.ai/api/v1/task",
            "method": "POST",
            "options": {},
            "jsonBody": "={\n\"model\": \"kling\",\n\"task_type\": \"video_generation\",\n\"input\": {\n\"prompt\": \"{{ $('Transform Prompt for Kling (GPT-4)').item.json.output }}\",\n\"negative_prompt\": \"\",\n\"cfg_scale\": 0.5,\n\"duration\": 10,\n\"aspect_ratio\": \"9:16\",\n\"version\": \"1.6\",\n\"camera_control\": {\n\"type\": \"simple\",\n\"config\": {\n\"horizontal\": 0,\n\"vertical\": 0,\n\"pan\": -10,\n\"tilt\": 0,\n\"roll\": 0,\n\"zoom\": 0\n}\n},\n\"mode\": \"std\"\n},\n\"config\": {\n\"service_mode\": \"\",\n\"webhook_config\": {\n\"endpoint\": \"\",\n\"secret\": \"\"\n}\n}\n}",
            "sendBody": true,
            "specifyBody": "json",
            "authentication": "genericCredentialType",
            "genericAuthType": "httpHeaderAuth"
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "MVPI2j7AopAMIJsX",
              "name": "Header Auth account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "3a28595b-af0b-4ea5-bf9c-be2f014eb3d6",
          "name": "Wait for Video Generation",
          "type": "n8n-nodes-base.wait",
          "position": [
            2032,
            -240
          ],
          "webhookId": "1b0f9389-5af5-40de-8522-170c8fcc76ae",
          "parameters": {
            "unit": "minutes",
            "amount": 7
          },
          "typeVersion": 1.1
        },
        {
          "id": "1d35b614-1ff0-4e53-9ea6-1ab63128d159",
          "name": "Get Generated Video URL",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            2128,
            -16
          ],
          "parameters": {
            "url": "=https://api.piapi.ai/api/v1/task/{{ $json.data.task_id }}",
            "options": {
              "response": {
                "response": {
                  "responseFormat": "json"
                }
              }
            },
            "authentication": "genericCredentialType",
            "genericAuthType": "httpHeaderAuth"
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "MVPI2j7AopAMIJsX",
              "name": "Header Auth account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "1a4b347b-6720-47bb-8623-ba49c5e7ed3f",
          "name": "Generate Voice-Over Script",
          "type": "@n8n/n8n-nodes-langchain.openAi",
          "position": [
            832,
            208
          ],
          "parameters": {
            "modelId": {
              "__rl": true,
              "mode": "list",
              "value": "gpt-4o",
              "cachedResultName": "GPT-4O"
            },
            "options": {},
            "messages": {
              "values": [
                {
                  "content": "=Task:\nCraft a short-form voice-over script that perfectly fits a 7-second video duration. The script should align with the following topic:\n\n{{ $('Extract Prompt & Caption').item.json.captionIdea }}\n\nRequirements:\n\nMatch the average spoken word count for a 7-second voice-over (approximately 18–22 words, depending on pacing).\n\nThe script must be tight, impactful, and written in a natural spoken tone suitable for narration.\n\nNo intro text or labels — return only the plain voice-over script with no headers or commentary.\n\n✅ Example (For Context Only):\nTopic: \"Why cold showers boost productivity\"\nGenerated Output:\nCold showers shock your system awake, boost focus, and kickstart circulation—training your brain to embrace discomfort."
                }
              ]
            }
          },
          "credentials": {
            "openAiApi": {
              "id": "SUSVT1243CEaMEmc",
              "name": "n8n free OpenAI API credits"
            }
          },
          "typeVersion": 1.8
        },
        {
          "id": "94c9199f-1a1c-42fc-ac75-a51903e7e28d",
          "name": "Convert Script to Audio (TTS)",
          "type": "@n8n/n8n-nodes-langchain.openAi",
          "position": [
            1232,
            272
          ],
          "parameters": {
            "input": "={{ $json.message.content }}",
            "options": {},
            "resource": "audio"
          },
          "credentials": {
            "openAiApi": {
              "id": "SUSVT1243CEaMEmc",
              "name": "n8n free OpenAI API credits"
            }
          },
          "typeVersion": 1.8
        },
        {
          "id": "0b78093c-a606-4d26-9ee1-b73100d208f7",
          "name": "Upload Audio to Cloudinary",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            1424,
            272
          ],
          "parameters": {
            "url": "https://api.cloudinary.com/v1_1/dc5wapno3/auto/upload",
            "options": {},
            "sendBody": true,
            "contentType": "multipart-form-data",
            "authentication": "genericCredentialType",
            "bodyParameters": {
              "parameters": [
                {
                  "name": "file",
                  "parameterType": "formBinaryData",
                  "inputDataFieldName": "data"
                },
                {
                  "name": "upload_preset",
                  "value": "n8n_video"
                }
              ]
            },
            "genericAuthType": "httpBasicAuth"
          },
          "credentials": {
            "httpBasicAuth": {
              "id": "7B0qFs8W6i2Tp4gM",
              "name": "Unnamed credential"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "3b0cb04d-4b3c-4209-ad01-5939ac5c639b",
          "name": "Merge Audio + Video",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            1664,
            272
          ],
          "parameters": {
            "url": "https://api.json2video.com/v2/movies",
            "method": "POST",
            "options": {},
            "jsonBody": "={\n\"resolution\": \"custom\",\n\"width\": 720,\n\"height\": 1280,\n\"scenes\": [\n{\n\"elements\": [\n{\n\"type\": \"video\",\n\"src\": \"{{ $('Get Generated Video URL').item.json.data.output.video_url }}\",\n\"resize\": \"cover\"\n},\n{\n\"type\": \"audio\",\n\"src\": \"{{ $json.url }}\"\n}\n]\n}\n]\n}",
            "sendBody": true,
            "specifyBody": "json",
            "authentication": "genericCredentialType",
            "genericAuthType": "httpHeaderAuth"
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "MVPI2j7AopAMIJsX",
              "name": "Header Auth account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "96be941f-0ead-4798-8433-2e0a86fbfefb",
          "name": "Wait for Audio/Video Fusion",
          "type": "n8n-nodes-base.wait",
          "position": [
            1968,
            272
          ],
          "webhookId": "36dbee1e-d027-43ab-9ae8-7b3b6d233746",
          "parameters": {
            "unit": "minutes",
            "amount": 1
          },
          "typeVersion": 1.1
        },
        {
          "id": "ba6f8a0a-7908-4d08-b6e6-b199f67f5e4d",
          "name": "Get Video URL with Audio",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            2240,
            272
          ],
          "parameters": {
            "url": "=https://api.json2video.com/v2/movies?id={{ $json.project }}",
            "options": {},
            "authentication": "genericCredentialType",
            "genericAuthType": "httpHeaderAuth"
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "MVPI2j7AopAMIJsX",
              "name": "Header Auth account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "10370650-cb6e-45cb-876b-cb0c098de954",
          "name": "Wait Before Captioning",
          "type": "n8n-nodes-base.wait",
          "position": [
            1424,
            576
          ],
          "webhookId": "6ab51bf7-67da-468f-af3d-3270cf0e7c77",
          "parameters": {
            "amount": 30
          },
          "typeVersion": 1.1
        },
        {
          "id": "39bb2488-034c-4a2d-a855-3f6e41169332",
          "name": "Add Captions/Subtitles to Video",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            1664,
            576
          ],
          "parameters": {
            "url": "https://api.json2video.com/v2/movies",
            "method": "POST",
            "options": {},
            "jsonBody": "={\n\"id\": \"qbaasr7s\",\n\"resolution\": \"custom\",\n\"quality\": \"high\",\n\"scenes\": [\n{\n\"id\": \"qyjh9lwj\",\n\"comment\": \"Scene 1\",\n\"elements\": []\n}\n],\n\"elements\": [\n{\n\"id\": \"q6dznzcv\",\n\"type\": \"video\",\n\"src\": \"{{ $json.movie.url }}\"\n},\n{\n\"id\": \"q41n9kxp\",\n\"type\": \"subtitles\",\n\"settings\": {\n\"style\": \"classic-progressive\",\n\"position\": \"center-center\",\n\"font-family\": \"Oswald\",\n\"font-size\": 140,\n\"word-color\": \"#ffd700\",\n\"shadow-color\": \"#260B1B\",\n\"line-color\": \"#F1E7F4\",\n\"shadow-offset\": 0,\n\"box-color\": \"#260B1B\",\n\"outline-color\": \"#000000\",\n\"outline-width\": 8\n},\n\"language\": \"en\"\n}\n],\n\"width\": 720,\n\"height\": 1280\n}",
            "sendBody": true,
            "specifyBody": "json",
            "authentication": "genericCredentialType",
            "genericAuthType": "httpHeaderAuth"
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "MVPI2j7AopAMIJsX",
              "name": "Header Auth account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "db1f6a3d-b3aa-40e3-8ae4-e2995149e58c",
          "name": "Wait for Caption Render",
          "type": "n8n-nodes-base.wait",
          "position": [
            1968,
            576
          ],
          "webhookId": "1b1b1f4e-c08b-4b92-adf5-9f8e5f65ce66",
          "parameters": {
            "unit": "minutes",
            "amount": 1
          },
          "typeVersion": 1.1
        },
        {
          "id": "045f715a-4742-459a-961b-717bef13e00c",
          "name": "Get Final Video URL (Audio + Captions)",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            2240,
            576
          ],
          "parameters": {
            "url": "=https://api.json2video.com/v2/movies?id={{ $json.project }}",
            "options": {},
            "authentication": "genericCredentialType",
            "genericAuthType": "httpHeaderAuth"
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "MVPI2j7AopAMIJsX",
              "name": "Header Auth account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "2871d494-4c7c-4c60-bafa-5ada2044a82f",
          "name": "Generate Social Caption from Voiceover",
          "type": "@n8n/n8n-nodes-langchain.openAi",
          "position": [
            880,
            912
          ],
          "parameters": {
            "modelId": {
              "__rl": true,
              "mode": "list",
              "value": "gpt-4o",
              "cachedResultName": "GPT-4O"
            },
            "options": {},
            "messages": {
              "values": [
                {
                  "content": "=📲 Prompt: Caption Generator for Voiceover-Based Social Posts\nYour Role:\nCreate a concise and engaging social media caption that builds directly on the voiceover script below:\n{{ $('Generate Voice-Over Script').item.json.message.content }}\n\n🧠 Caption Guidelines:\nKeep it short, compelling, and value-driven.\n\nAvoid generic motivational fluff — focus on real, actionable insight or highlight a problem/solution pattern.\n\n\nStructure:\n\nOne sentence per line.\n\nNote: Do not use this character: \" in the result.\nReturn a single short paragraph with no line breaks and no special characters.\nNote: Do not use this character: \" in the result.\n"
                }
              ]
            }
          },
          "credentials": {
            "openAiApi": {
              "id": "SUSVT1243CEaMEmc",
              "name": "n8n free OpenAI API credits"
            }
          },
          "typeVersion": 1.8
        },
        {
          "id": "7c970fc1-f5a7-4ee7-9f21-73b92109eb69",
          "name": "Generate YouTube-Style Title",
          "type": "@n8n/n8n-nodes-langchain.openAi",
          "position": [
            1280,
            912
          ],
          "parameters": {
            "modelId": {
              "__rl": true,
              "mode": "list",
              "value": "gpt-4o",
              "cachedResultName": "GPT-4O"
            },
            "options": {},
            "messages": {
              "values": [
                {
                  "content": "=Act as a YouTube Title Expert.\nBased on the following video description:\n{{ $('Generate Voice-Over Script').item.json.message.content }}\nGenerate a short, punchy, and curiosity-driven YouTube video title that makes people want to click.\nMake it feel urgent, valuable, or surprising — and avoid generic or boring phrases.\nKeep it under 70 characters. Return only the title, no explanations.\nNote: The title must be free of special characters and the character \". Return only a plain text title.\n\n"
                }
              ]
            }
          },
          "credentials": {
            "openAiApi": {
              "id": "SUSVT1243CEaMEmc",
              "name": "n8n free OpenAI API credits"
            }
          },
          "typeVersion": 1.8
        },
        {
          "id": "69e7e003-76d6-42da-b1c9-e0bab411feb8",
          "name": "Save Video Metadata to Google Sheets",
          "type": "n8n-nodes-base.googleSheets",
          "position": [
            1664,
            912
          ],
          "parameters": {
            "columns": {
              "value": {
                "Titre": "={{ $json.message.content }}",
                "PROMPT": "={{ $('Trigger: Telegram Prompt').item.json.message.text }}",
                "URL VIDEO": "={{ $('Get Final Video URL (Audio + Captions)').item.json.movie.url }}",
                "DESCRIPTION": "={{ $('Generate Social Caption from Voiceover').item.json.message.content }}"
              },
              "schema": [
                {
                  "id": "PROMPT",
                  "type": "string",
                  "display": true,
                  "required": false,
                  "displayName": "PROMPT",
                  "defaultMatch": false,
                  "canBeUsedToMatch": true
                },
                {
                  "id": "DESCRIPTION",
                  "type": "string",
                  "display": true,
                  "required": false,
                  "displayName": "DESCRIPTION",
                  "defaultMatch": false,
                  "canBeUsedToMatch": true
                },
                {
                  "id": "URL VIDEO",
                  "type": "string",
                  "display": true,
                  "required": false,
                  "displayName": "URL VIDEO",
                  "defaultMatch": false,
                  "canBeUsedToMatch": true
                },
                {
                  "id": "Titre",
                  "type": "string",
                  "display": true,
                  "removed": false,
                  "required": false,
                  "displayName": "Titre",
                  "defaultMatch": false,
                  "canBeUsedToMatch": true
                }
              ],
              "mappingMode": "defineBelow",
              "matchingColumns": [],
              "attemptToConvertTypes": false,
              "convertFieldsToString": false
            },
            "options": {},
            "operation": "append",
            "sheetName": {
              "__rl": true,
              "mode": "id",
              "value": "="
            },
            "documentId": {
              "__rl": true,
              "mode": "id",
              "value": "="
            }
          },
          "credentials": {
            "googleSheetsOAuth2Api": {
              "id": "SyIHHLBmtjueic3y",
              "name": "Google Sheets account 2"
            }
          },
          "typeVersion": 4.5
        },
        {
          "id": "e1952888-351d-4f7d-89cf-0ddbd413b76d",
          "name": "Send Final Video to Telegram",
          "type": "n8n-nodes-base.telegram",
          "position": [
            1968,
            912
          ],
          "webhookId": "c70c5281-99b5-4eaa-a597-c110fc3e6fab",
          "parameters": {
            "file": "={{ $json['URL VIDEO'] }}",
            "chatId": "={{ $('Trigger: Telegram Prompt').item.json.message.chat.id }}",
            "operation": "sendVideo",
            "additionalFields": {}
          },
          "credentials": {
            "telegramApi": {
              "id": "lF3ysozDsYnjleSa",
              "name": "Telegram account"
            }
          },
          "typeVersion": 1.2
        },
        {
          "id": "f2fb9c3e-86b9-4036-8572-e427f453ddfa",
          "name": "Send Caption Link via Telegram",
          "type": "n8n-nodes-base.telegram",
          "position": [
            2192,
            912
          ],
          "webhookId": "d9e210ef-c704-4478-b78c-21662156b700",
          "parameters": {
            "text": "={{ $('Save Video Metadata to Google Sheets').item.json.DESCRIPTION }}\n\nLink here : {{ $('Save Video Metadata to Google Sheets').item.json['URL VIDEO'] }}",
            "chatId": "={{ $json.result.chat.id }}",
            "additionalFields": {}
          },
          "credentials": {
            "telegramApi": {
              "id": "lF3ysozDsYnjleSa",
              "name": "Telegram account"
            }
          },
          "typeVersion": 1.2
        },
        {
          "id": "09c9a0d8-9bfb-4bae-837c-e1ed21f11af5",
          "name": "If",
          "type": "n8n-nodes-base.if",
          "position": [
            2384,
            928
          ],
          "parameters": {
            "options": {},
            "conditions": {
              "options": {
                "version": 2,
                "leftValue": "",
                "caseSensitive": true,
                "typeValidation": "strict"
              },
              "combinator": "and",
              "conditions": [
                {
                  "id": "ca2af2df-e6d2-40a1-94a9-18659beb937d",
                  "operator": {
                    "name": "filter.operator.equals",
                    "type": "string",
                    "operation": "equals"
                  },
                  "leftValue": "={{ $json[\"callback_query\"][\"data\"] }}",
                  "rightValue": "={{\"approved\" }}"
                }
              ]
            }
          },
          "typeVersion": 2.2
        },
        {
          "id": "319c19d8-0cf4-4830-95cb-5abd0721875e",
          "name": "Create a task",
          "type": "n8n-nodes-base.highLevel",
          "position": [
            1456,
            1200
          ],
          "parameters": {
            "title": "Bh",
            "dueDate": "2025-05-01T00:00:00",
            "resource": "task",
            "contactId": "=ok",
            "requestOptions": {},
            "additionalFields": {}
          },
          "credentials": {
            "highLevelOAuth2Api": {
              "id": "MTMGNlbRBbBaCBvn",
              "name": "HighLevel account"
            }
          },
          "typeVersion": 2
        },
        {
          "id": "20bda5a6-8312-46fc-bbd2-6db29af10854",
          "name": "Sticky Note3",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            1328,
            1136
          ],
          "parameters": {
            "color": 3,
            "width": 464,
            "height": 256,
            "content": "## Post Through High-level "
          },
          "typeVersion": 1
        },
        {
          "id": "688485dc-a2a3-48b9-81c0-b1211b8b23fa",
          "name": "Generate Image via Kling API1",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            1808,
            -32
          ],
          "parameters": {
            "url": "https://api.piapi.ai/api/v1/task",
            "method": "POST",
            "options": {},
            "jsonBody": "={\n\"model\": \"kling\",\n\"task_type\": \"video_generation\",\n\"input\": {\n\"prompt\": \"{{ $('Transform Prompt for Kling (GPT-4)').item.json.output }}\",\n\"negative_prompt\": \"\",\n\"cfg_scale\": 0.5,\n\"duration\": 10,\n\"aspect_ratio\": \"9:16\",\n\"version\": \"1.6\",\n\"camera_control\": {\n\"type\": \"simple\",\n\"config\": {\n\"horizontal\": 0,\n\"vertical\": 0,\n\"pan\": -10,\n\"tilt\": 0,\n\"roll\": 0,\n\"zoom\": 0\n}\n},\n\"mode\": \"std\"\n},\n\"config\": {\n\"service_mode\": \"\",\n\"webhook_config\": {\n\"endpoint\": \"\",\n\"secret\": \"\"\n}\n}\n}",
            "sendBody": true,
            "specifyBody": "json",
            "authentication": "genericCredentialType",
            "genericAuthType": "httpHeaderAuth"
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "MVPI2j7AopAMIJsX",
              "name": "Header Auth account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "f18efff8-9338-4426-b389-34ca230b8ba9",
          "name": "Switch",
          "type": "n8n-nodes-base.switch",
          "position": [
            1536,
            -96
          ],
          "parameters": {
            "rules": {
              "values": [
                {
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "b8bc8dee-47db-429d-a6e5-0ad5571196e9",
                        "operator": {
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "",
                        "rightValue": ""
                      }
                    ]
                  }
                },
                {
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "1005fe69-ed16-4715-b1de-91438b0afc7a",
                        "operator": {
                          "name": "filter.operator.equals",
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "",
                        "rightValue": ""
                      }
                    ]
                  }
                }
              ]
            },
            "options": {}
          },
          "typeVersion": 3.2
        }
      ],
      "active": false,
      "pinData": {},
      "settings": {
        "executionOrder": "v1"
      },
      "versionId": "62723f12-36b7-4a30-9d03-31c5c6d80525",
      "connections": {
        "If": {
          "main": [
            [
              {
                "node": "Create a task",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Transform Prompt for Kling (GPT-4)",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Switch": {
          "main": [
            [
              {
                "node": "Generate Video via Kling API",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Generate Image via Kling API1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Create a task": {
          "main": [
            []
          ]
        },
        "Merge Audio + Video": {
          "main": [
            [
              {
                "node": "Wait for Audio/Video Fusion",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "OpenAI Model Bridge": {
          "ai_languageModel": [
            [
              {
                "node": "Transform Prompt for Kling (GPT-4)",
                "type": "ai_languageModel",
                "index": 0
              }
            ]
          ]
        },
        "Wait Before Captioning": {
          "main": [
            [
              {
                "node": "Add Captions/Subtitles to Video",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Get Generated Video URL": {
          "main": [
            [
              {
                "node": "Generate Voice-Over Script",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Wait for Caption Render": {
          "main": [
            [
              {
                "node": "Get Final Video URL (Audio + Captions)",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Extract Prompt & Caption": {
          "main": [
            [
              {
                "node": "Transform Prompt for Kling (GPT-4)",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Get Video URL with Audio": {
          "main": [
            [
              {
                "node": "Wait Before Captioning",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Trigger: Telegram Prompt": {
          "main": [
            [
              {
                "node": "Extract Prompt & Caption",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Wait for Video Generation": {
          "main": [
            [
              {
                "node": "Get Generated Video URL",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Generate Voice-Over Script": {
          "main": [
            [
              {
                "node": "Convert Script to Audio (TTS)",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Upload Audio to Cloudinary": {
          "main": [
            [
              {
                "node": "Merge Audio + Video",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Wait for Audio/Video Fusion": {
          "main": [
            [
              {
                "node": "Get Video URL with Audio",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Generate Video via Kling API": {
          "main": [
            [
              {
                "node": "Wait for Video Generation",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Generate YouTube-Style Title": {
          "main": [
            [
              {
                "node": "Save Video Metadata to Google Sheets",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Send Final Video to Telegram": {
          "main": [
            [
              {
                "node": "Send Caption Link via Telegram",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Convert Script to Audio (TTS)": {
          "main": [
            [
              {
                "node": "Upload Audio to Cloudinary",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Generate Image via Kling API1": {
          "main": [
            [
              {
                "node": "Add Captions/Subtitles to Video",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Send Caption Link via Telegram": {
          "main": [
            [
              {
                "node": "If",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Add Captions/Subtitles to Video": {
          "main": [
            [
              {
                "node": "Wait for Caption Render",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Transform Prompt for Kling (GPT-4)": {
          "main": [
            [
              {
                "node": "Switch",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Save Video Metadata to Google Sheets": {
          "main": [
            [
              {
                "node": "Send Final Video to Telegram",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Generate Social Caption from Voiceover": {
          "main": [
            [
              {
                "node": "Generate YouTube-Style Title",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Get Final Video URL (Audio + Captions)": {
          "main": [
            [
              {
                "node": "Generate Social Caption from Voiceover",
                "type": "main",
                "index": 0
              }
            ]
          ]
        }
      }
    }