{
  "name": "⚡ Text → Viral Shorts | AI Video Studio in Telegram /w Setup Video",
  "nodes": [
    {
      "id": "e7bfb21b-965b-4614-b17a-f389b0b1be5c",
      "name": "Main",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4672,
        -2016
      ],
      "parameters": {
        "width": 400,
        "height": 632,
        "content": "## How it works\n\n1. User sends a text or image prompt to your Telegram bot\n2. OpenAI enhances the prompt and generates video metadata\n3. User selects an AI model (Veo 3.1, Sora 2, or Seedance)\n4. Vide"
      }
    },
    {
      "id": "4ec4a93e-1f93-4266-9ef1-f8f69f2f8df3",
      "name": "Telegram Input",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4960,
        -1120
      ],
      "parameters": {
        "width": 196,
        "height": 96,
        "content": "**Telegram Trigger** — Receives messages and button callbacks, routes to handlers"
      }
    },
    {
      "id": "f1e20d54-12ea-466d-aa43-66fa9c818479",
      "name": "Prompt Generation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4080,
        -2576
      ],
      "parameters": {
        "width": 2240,
        "height": 352,
        "content": "**Prompt Generation** — Extracts input, calls OpenAI, stores session in Redis"
      }
    },
    {
      "id": "9998e5e0-4779-48b3-8843-934a74dd4b03",
      "name": "Video Generation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4080,
        -2112
      ],
      "parameters": {
        "width": 2688,
        "height": 208,
        "content": "**Video Generation** — Checks balance, starts KIE.ai job, triggers polling webhook"
      }
    },
    {
      "id": "723f5a09-a1fb-4266-ba46-b22805f51380",
      "name": "YouTube Publishing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4080,
        -1744
      ],
      "parameters": {
        "width": 1936,
        "height": 208,
        "content": "**YouTube Shorts** — Downloads from S3, uploads to YouTube with metadata"
      }
    },
    {
      "id": "e67cac4c-0238-4d47-9c56-68ffe28ad428",
      "name": "Social Publishing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4048,
        -320
      ],
      "parameters": {
        "width": 2000,
        "height": 592,
        "content": "**TikTok & Instagram** — Publishes via Late.dev API with auto-generated captions"
      }
    },
    {
      "id": "db0aba18-f06a-4570-b299-c73e4aa78430",
      "name": "Video Extension",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2528,
        -1360
      ],
      "parameters": {
        "width": 1552,
        "height": 208,
        "content": "**Extend Video** — Adds 8 seconds using OpenAI continuation prompt (Veo only)"
      }
    },
    {
      "id": "7907fc5f-68a6-4287-af9c-85bede1be4a8",
      "name": "Video Merge",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3888,
        -864
      ],
      "parameters": {
        "width": 224,
        "height": 80,
        "content": "**Auto-Merge** — Concatenates original + extended video via Transloadit"
      }
    },
    {
      "id": "b6ef9103-09a4-4893-bc62-928801ff6c01",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -4704,
        -1120
      ]
    },
    {
      "id": "632b0e0a-d6fe-4d0e-abb0-e5779d98cc23",
      "name": "Determine Route",
      "type": "n8n-nodes-base.code",
      "position": [
        -4480,
        -1120
      ]
    },
    {
      "id": "1111d077-c462-46fa-b3a7-a67cf4ea197a",
      "name": "Route Input",
      "type": "n8n-nodes-base.switch",
      "position": [
        -4256,
        -1264
      ]
    },
    {
      "id": "b08060df-93d9-4b29-8f5a-4c8920b682a3",
      "name": "Extract Input",
      "type": "n8n-nodes-base.code",
      "position": [
        -4048,
        -2464
      ]
    },
    {
      "id": "3214d6ca-74e5-4a9a-9ff0-1a20da9b0992",
      "name": "Send Initial Status",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -3808,
        -2528
      ]
    },
    {
      "id": "2199dcf2-2d5d-4f92-ad97-7614e7cfde01",
      "name": "Has Photo?",
      "type": "n8n-nodes-base.if",
      "position": [
        -3808,
        -2368
      ]
    },
    {
      "id": "928e6c0c-d468-4d6f-88bb-49b3dca85c15",
      "name": "Get Photo URL",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -3600,
        -2528
      ]
    },
    {
      "id": "7929e961-fbef-4134-a560-b5c4dfc27093",
      "name": "Build Photo URL",
      "type": "n8n-nodes-base.code",
      "position": [
        -3392,
        -2528
      ]
    },
    {
      "id": "925ddd69-bbaf-4c28-963a-ab9df95d2e04",
      "name": "No Photo",
      "type": "n8n-nodes-base.code",
      "position": [
        -3504,
        -2352
      ]
    },
    {
      "id": "7010b454-c5dd-40df-b4ff-488704d063d5",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        -3184,
        -2464
      ]
    },
    {
      "id": "23c0c1bb-3933-4185-9ba7-72892b39e00b",
      "name": "Send Prompt Status",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -2928,
        -2464
      ]
    },
    {
      "id": "34e628d0-0e3d-41a3-b072-f33ab70fd21d",
      "name": "Generate Prompt & Metadata",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2688,
        -2464
      ]
    },
    {
      "id": "4af0464b-242b-4b74-81c6-12c055a4e972",
      "name": "Format Session",
      "type": "n8n-nodes-base.code",
      "position": [
        -2464,
        -2464
      ]
    },
    {
      "id": "418f5b83-b9d1-429e-addf-600ebb67d360",
      "name": "Store Session",
      "type": "n8n-nodes-base.redis",
      "position": [
        -2240,
        -2464
      ]
    },
    {
      "id": "f613992f-e549-441a-9342-0900c89a4ad4",
      "name": "Send Prompt for Approval",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -2032,
        -2464
      ]
    },
    {
      "id": "dddf8b39-c30f-4627-b1a1-fa024de1234a",
      "name": "Parse Model Selection",
      "type": "n8n-nodes-base.code",
      "position": [
        -4048,
        -2064
      ]
    },
    {
      "id": "e730ff10-6fa5-41c0-aa91-f69e636c2d20",
      "name": "Answer Generate",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -3840,
        -2064
      ]
    },
    {
      "id": "01f01642-e908-47de-af10-6e74fcef6443",
      "name": "Get Session",
      "type": "n8n-nodes-base.redis",
      "position": [
        -3632,
        -2064
      ]
    },
    {
      "id": "f14b4710-d9af-4e04-944d-d5c4554d70c2",
      "name": "Parse Session",
      "type": "n8n-nodes-base.code",
      "position": [
        -3424,
        -2064
      ]
    },
    {
      "id": "5576f367-d30e-453a-9563-174d297b2528",
      "name": "Start Video Generation",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2464,
        -2080
      ]
    },
    {
      "id": "965bde5a-1f6b-4a3c-b967-8628099c725f",
      "name": "Add Task ID",
      "type": "n8n-nodes-base.code",
      "position": [
        -2256,
        -2080
      ]
    },
    {
      "id": "a994acc5-2da0-4db3-889e-fea83bda5e1e",
      "name": "Store Generating Session",
      "type": "n8n-nodes-base.redis",
      "position": [
        -2048,
        -2080
      ]
    },
    {
      "id": "be35fc57-d409-4759-8bd8-a89611fcda5e",
      "name": "Send Generating Status",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1808,
        -2080
      ]
    },
    {
      "id": "b3c1a6d4-a3cf-49e7-8af5-e6379b609219",
      "name": "Trigger Polling",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1568,
        -2080
      ]
    },
    {
      "id": "10429dc2-ed34-480c-b715-37a22c5df33e",
      "name": "Parse Publish",
      "type": "n8n-nodes-base.code",
      "position": [
        -4048,
        -1696
      ]
    },
    {
      "id": "c7566b25-bbdb-4d41-aa7d-1054a3ba4713",
      "name": "Answer Publish",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -3840,
        -1696
      ]
    },
    {
      "id": "4c98ffb4-b7ff-4be4-91be-c8fdcfebc20f",
      "name": "Get Session (Publish)",
      "type": "n8n-nodes-base.redis",
      "position": [
        -3632,
        -1696
      ]
    },
    {
      "id": "ededbb21-81e7-4bf0-9a4b-6db1dd429c73",
      "name": "Parse Session (Publish)",
      "type": "n8n-nodes-base.code",
      "position": [
        -3408,
        -1696
      ]
    },
    {
      "id": "d29460e7-55d4-4192-83fb-bc141ffc00d5",
      "name": "Download Video",
      "type": "n8n-nodes-base.s3",
      "position": [
        -3200,
        -1696
      ]
    },
    {
      "id": "e42050ba-efc9-40c0-a0bd-30d22dd3da06",
      "name": "Upload to YouTube",
      "type": "n8n-nodes-base.youTube",
      "position": [
        -2976,
        -1696
      ]
    },
    {
      "id": "1b8d6d1f-762a-4b54-b376-db4043ce35e9",
      "name": "Format Results",
      "type": "n8n-nodes-base.code",
      "position": [
        -2768,
        -1696
      ]
    },
    {
      "id": "cf2fbefd-7944-417c-85f7-b0605dad6b17",
      "name": "Update Session",
      "type": "n8n-nodes-base.redis",
      "position": [
        -2560,
        -1696
      ]
    },
    {
      "id": "9c19010b-75ad-4c89-b84e-3b14727cf103",
      "name": "Send Success",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -2336,
        -1696
      ]
    },
    {
      "id": "e2821666-88ee-4f21-9113-aa617b9cef28",
      "name": "Parse Cancel",
      "type": "n8n-nodes-base.code",
      "position": [
        -4048,
        -1456
      ]
    },
    {
      "id": "deaf12b1-83e6-4d75-9750-96fba3dd41a1",
      "name": "Answer Cancel",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -3840,
        -1456
      ]
    },
    {
      "id": "bb77e879-37d7-4fb2-a7f9-ee09d07a095a",
      "name": "Delete Session",
      "type": "n8n-nodes-base.redis",
      "position": [
        -3632,
        -1456
      ]
    },
    {
      "id": "fcf3c8a7-221c-4cc8-98b0-f05dd35e8973",
      "name": "Send Cancel",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -3408,
        -1456
      ]
    },
    {
      "id": "f5d372e9-595e-44b4-b812-fdac5ba64a14",
      "name": "Check Balance",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -3216,
        -2064
      ]
    },
    {
      "id": "ab75f008-1671-429f-85b4-3bbcfdb1d338",
      "name": "Validate Balance",
      "type": "n8n-nodes-base.code",
      "position": [
        -2992,
        -2064
      ]
    },
    {
      "id": "ac66ca1b-8546-4711-8da7-fc10013b08bd",
      "name": "Balance OK?",
      "type": "n8n-nodes-base.if",
      "position": [
        -2800,
        -2064
      ]
    },
    {
      "id": "10ac5081-636f-4cc8-bc97-88bd1fa314e2",
      "name": "Send Insufficient Balance",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -2608,
        -1952
      ]
    },
    {
      "id": "2341b6a5-2d5e-4a4f-800b-7eb4498f3db8",
      "name": "Send Help",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -4048,
        -1296
      ]
    },
    {
      "id": "498119ab-337e-495e-949f-76ee564f4a9c",
      "name": "Parse Extend",
      "type": "n8n-nodes-base.code",
      "position": [
        -4048,
        -1120
      ]
    },
    {
      "id": "8f13c7d9-0e22-4cc9-aa53-aab3f28eb538",
      "name": "Answer Extend",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -3808,
        -1120
      ]
    },
    {
      "id": "b46cbb74-4dab-48af-9b40-9d5a8e46107f",
      "name": "Get Session (Extend)",
      "type": "n8n-nodes-base.redis",
      "position": [
        -3584,
        -1120
      ]
    },
    {
      "id": "d30142ab-b838-42f1-9c8b-e2b09d22c417",
      "name": "Parse Session (Extend)",
      "type": "n8n-nodes-base.code",
      "position": [
        -3360,
        -1120
      ]
    },
    {
      "id": "f9215165-3357-41b9-a96e-8d9a17d6d23f",
      "name": "Check Extend Balance",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -3136,
        -1120
      ]
    },
    {
      "id": "cae903eb-0a1b-42d4-b85f-bcb602a8b3da",
      "name": "Validate Extend Balance",
      "type": "n8n-nodes-base.code",
      "position": [
        -2912,
        -1120
      ]
    },
    {
      "id": "b29b45f0-1151-4540-8b75-35e146d88598",
      "name": "Extend Balance OK?",
      "type": "n8n-nodes-base.if",
      "position": [
        -2688,
        -1120
      ]
    },
    {
      "id": "9159f626-1d48-4e07-a64e-a165cc83ea6a",
      "name": "Send Insufficient Extend Balance",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -2464,
        -1104
      ]
    },
    {
      "id": "f046e01d-4cc8-47b2-80ac-1658d76689d2",
      "name": "Generate Extend Prompt",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2464,
        -1312
      ]
    },
    {
      "id": "b89f704b-66fd-4164-9ecf-c4d17096cede",
      "name": "Parse Extend Prompt",
      "type": "n8n-nodes-base.code",
      "position": [
        -2240,
        -1312
      ]
    },
    {
      "id": "7f19f697-0570-478c-a09b-3e1ff1cafadc",
      "name": "Start Extend Generation",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2016,
        -1312
      ]
    },
    {
      "id": "d7e4bd08-d45c-49d7-b03f-1b871df153e8",
      "name": "Add Extend Task ID",
      "type": "n8n-nodes-base.code",
      "position": [
        -1792,
        -1312
      ]
    },
    {
      "id": "a7b0309f-1638-468b-8c75-c6ea9aa00174",
      "name": "Store Extending Session",
      "type": "n8n-nodes-base.redis",
      "position": [
        -1584,
        -1312
      ]
    },
    {
      "id": "518d4f97-8c72-4577-932e-43fe6e10c686",
      "name": "Send Extending Status",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1376,
        -1312
      ]
    },
    {
      "id": "fe0a4a6f-f55f-4fbf-9939-6400b65f095c",
      "name": "Trigger Extend Polling",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1168,
        -1312
      ]
    },
    {
      "id": "d32fad11-c093-4b7e-9b73-7b3afcf0c2ac",
      "name": "Parse TikTok",
      "type": "n8n-nodes-base.code",
      "position": [
        -4032,
        -272
      ]
    },
    {
      "id": "d7acf57e-eaea-4bce-8e35-618bee73a43e",
      "name": "Answer TikTok",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -3808,
        -272
      ]
    },
    {
      "id": "c00b4f9f-8ca7-447a-a424-fec01cb53d64",
      "name": "Send TikTok Status",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -3584,
        -272
      ]
    },
    {
      "id": "666848d6-3a4b-49c6-a90f-b389080714ed",
      "name": "Get Session (TikTok)",
      "type": "n8n-nodes-base.redis",
      "position": [
        -3360,
        -272
      ]
    },
    {
      "id": "ddcf04ee-172c-44d0-8b7f-5d979750bf78",
      "name": "Publish to TikTok",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2464,
        -272
      ]
    },
    {
      "id": "855fcb1b-cd97-4ce7-bdc3-dd91af3048dc",
      "name": "Prepare KIE Request (TikTok)",
      "type": "n8n-nodes-base.code",
      "position": [
        -3136,
        -272
      ]
    },
    {
      "id": "901a2f7c-3b8e-4418-a925-6d1a7d96c0d3",
      "name": "Fetch Video URL (TikTok)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2912,
        -272
      ]
    },
    {
      "id": "336d283f-a212-4d69-ac6d-9713e04f42c1",
      "name": "Prepare Publish (TikTok)",
      "type": "n8n-nodes-base.code",
      "position": [
        -2688,
        -272
      ]
    },
    {
      "id": "dc2710b7-8fef-4862-8b91-ac44cdbd54c2",
      "name": "Send TikTok Success",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -2240,
        -272
      ]
    },
    {
      "id": "cd514af2-7505-4bce-aa7d-9059ab989ebc",
      "name": "Parse Instagram",
      "type": "n8n-nodes-base.code",
      "position": [
        -4032,
        -80
      ]
    },
    {
      "id": "392a4dfb-c7a1-4f64-9d6e-e8b36fa7e1bb",
      "name": "Answer Instagram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -3808,
        -80
      ]
    },
    {
      "id": "a49e2b14-88b9-4524-92f6-a50ccc6056e2",
      "name": "Send Instagram Status",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -3584,
        -80
      ]
    },
    {
      "id": "ca50e3a9-9c84-458d-8e17-17bcc9faa42c",
      "name": "Get Session (Instagram)",
      "type": "n8n-nodes-base.redis",
      "position": [
        -3360,
        -80
      ]
    },
    {
      "id": "7fb93d2b-25e4-4fa3-a6df-0af17c68242e",
      "name": "Publish to Instagram",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2464,
        -80
      ]
    },
    {
      "id": "8e92b041-dbee-4e60-8aa8-cbfab8fdd2ef",
      "name": "Prepare KIE Request (Instagram)",
      "type": "n8n-nodes-base.code",
      "position": [
        -3136,
        -80
      ]
    },
    {
      "id": "27b8f324-897d-49e6-9473-42e37f94b758",
      "name": "Fetch Video URL (Instagram)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2912,
        -80
      ]
    },
    {
      "id": "f0677ed4-f962-437d-96fe-8e50c7ddfbbc",
      "name": "Prepare Publish (Instagram)",
      "type": "n8n-nodes-base.code",
      "position": [
        -2688,
        -80
      ]
    },
    {
      "id": "9bc231d2-48bf-4c44-978c-a8c0e6096c93",
      "name": "Send Instagram Success",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -2240,
        -80
      ]
    },
    {
      "id": "7a4e692c-8dd9-4b4f-ac3b-b3b87714190a",
      "name": "Parse PublishAll",
      "type": "n8n-nodes-base.code",
      "position": [
        -4032,
        112
      ]
    },
    {
      "id": "959edf38-8ef6-4961-95d0-c5d3b29f5de5",
      "name": "Answer PublishAll",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -3808,
        112
      ]
    },
    {
      "id": "3f9883d0-5a57-4a89-8ce2-31ad9735d756",
      "name": "Send PublishAll Status",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -3584,
        112
      ]
    },
    {
      "id": "66b79127-e78b-4875-bfff-c1f5a4426773",
      "name": "Get Session (PublishAll)",
      "type": "n8n-nodes-base.redis",
      "position": [
        -3360,
        112
      ]
    },
    {
      "id": "fd99fb4b-caf2-435f-bbc3-a9a617aa40ab",
      "name": "Publish to All Platforms",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2464,
        112
      ]
    },
    {
      "id": "5058d989-0e72-47cd-8e1b-b12a7e01a692",
      "name": "Prepare KIE Request (PublishAll)",
      "type": "n8n-nodes-base.code",
      "position": [
        -3136,
        112
      ]
    },
    {
      "id": "652264ec-20ad-41ce-a1bd-9f3570e86b34",
      "name": "Fetch Video URL (PublishAll)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2912,
        112
      ]
    },
    {
      "id": "fe22a7b2-8d31-4dc2-ba29-b8c0bbb3b0c2",
      "name": "Prepare Publish (PublishAll)",
      "type": "n8n-nodes-base.code",
      "position": [
        -2688,
        112
      ]
    },
    {
      "id": "640bfa01-b90e-4429-87c2-66ff6d3b1ac7",
      "name": "Send PublishAll Success",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -2240,
        112
      ]
    },
    {
      "id": "9558dc7c-1597-49d5-86ef-f22aa828fd31",
      "name": "Parse AutoMerge",
      "type": "n8n-nodes-base.code",
      "position": [
        -4016,
        -800
      ]
    },
    {
      "id": "41f5f5a4-a2a9-45b2-80a5-09809b9e508e",
      "name": "Parse ManualMerge",
      "type": "n8n-nodes-base.code",
      "position": [
        -4016,
        -560
      ]
    },
    {
      "id": "61070423-1845-4ab7-902e-cb80c6fac942",
      "name": "Send Merging Status",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -3056,
        -800
      ]
    },
    {
      "id": "faaa8eee-0848-426c-97ea-e077f500777c",
      "name": "Send Manual Links",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -3136,
        -560
      ]
    },
    {
      "id": "7673cb96-33a6-4b44-bc62-60449ffaab98",
      "name": "Get Manual URLs",
      "type": "n8n-nodes-base.code",
      "position": [
        -3360,
        -560
      ]
    },
    {
      "id": "33626c67-bd19-42b1-997e-a30dd4f552b6",
      "name": "Create Transloadit Assembly",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2848,
        -800
      ]
    },
    {
      "id": "d1c8fdfa-86c8-4dbe-9d0f-751e88fbfae6",
      "name": "Parse Assembly Response",
      "type": "n8n-nodes-base.code",
      "position": [
        -2640,
        -800
      ]
    },
    {
      "id": "7355a230-cff2-40ec-bf05-1f4a8e3a1597",
      "name": "Wait for Merge",
      "type": "n8n-nodes-base.wait",
      "position": [
        -2416,
        -800
      ]
    },
    {
      "id": "52ce532a-3c78-4389-b2b6-b365c790349d",
      "name": "Poll Assembly Status",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2192,
        -800
      ]
    },
    {
      "id": "a43b684c-a410-45f9-808b-17130536384d",
      "name": "Check Merge Complete",
      "type": "n8n-nodes-base.code",
      "position": [
        -1968,
        -800
      ]
    },
    {
      "id": "0fba91d6-8416-49cd-a24a-9c7918cdf61a",
      "name": "Merge Complete?",
      "type": "n8n-nodes-base.if",
      "position": [
        -1792,
        -800
      ]
    },
    {
      "id": "7ace11d3-c980-4a69-bcd1-7375901a144c",
      "name": "Still Executing",
      "type": "n8n-nodes-base.code",
      "position": [
        -1360,
        -640
      ]
    },
    {
      "id": "395fe5b0-c39e-47f6-b434-7ba8ff5a54e2",
      "name": "Send Merge Failed",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1360,
        -816
      ]
    },
    {
      "id": "2e3b7e93-85ca-494f-a0bd-52c702eac140",
      "name": "Check Failed?",
      "type": "n8n-nodes-base.if",
      "position": [
        -1568,
        -768
      ]
    },
    {
      "id": "da9be349-be2c-4e8a-a174-4a88df70bda7",
      "name": "Download Merged Video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1568,
        -960
      ]
    },
    {
      "id": "39d3f66f-7965-4346-ad80-7d6bc45712b0",
      "name": "Prepare Merged Session",
      "type": "n8n-nodes-base.code",
      "position": [
        -1360,
        -960
      ]
    },
    {
      "id": "bdf1d50f-9f41-47cf-addd-feedad0b6122",
      "name": "Upload Merged to S3",
      "type": "n8n-nodes-base.s3",
      "position": [
        -1152,
        -960
      ]
    },
    {
      "id": "e136f900-062e-41de-946b-2df721a0ac91",
      "name": "Get Original Session",
      "type": "n8n-nodes-base.redis",
      "position": [
        -944,
        -960
      ]
    },
    {
      "id": "8d078ac0-4b08-4077-805b-2b9537553d4e",
      "name": "Create Merged Session",
      "type": "n8n-nodes-base.code",
      "position": [
        -720,
        -960
      ]
    },
    {
      "id": "c6ead8cb-a606-4110-a2a8-db5f6e19eb21",
      "name": "Store Merged Session",
      "type": "n8n-nodes-base.redis",
      "position": [
        -496,
        -960
      ]
    },
    {
      "id": "a2fcacd2-33e3-42bc-9412-b099e26167b3",
      "name": "Download Merged for Telegram",
      "type": "n8n-nodes-base.s3",
      "position": [
        -304,
        -960
      ]
    },
    {
      "id": "83f3d6fc-b0a5-422a-96d9-3541b6ea10a9",
      "name": "Send Merged Video",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -112,
        -960
      ]
    },
    {
      "id": "a348068e-0f8c-4af7-a39d-2f6ff1fe3c08",
      "name": "Fetch Original Session",
      "type": "n8n-nodes-base.redis",
      "position": [
        -3632,
        -800
      ]
    },
    {
      "id": "801f6ad6-fd74-44bd-91c7-8d6cf672f517",
      "name": "Fetch Extension Session",
      "type": "n8n-nodes-base.redis",
      "position": [
        -3440,
        -800
      ]
    },
    {
      "id": "caed3b47-542e-4e95-b227-2d7ce7330777",
      "name": "Get Merge URLs",
      "type": "n8n-nodes-base.code",
      "position": [
        -3248,
        -800
      ]
    },
    {
      "id": "4bfb70cf-a105-42b6-9c1c-09fa7f0b9a70",
      "name": "Fetch Original (Manual)",
      "type": "n8n-nodes-base.redis",
      "position": [
        -3808,
        -560
      ]
    },
    {
      "id": "929f5bdc-6c16-4dbe-b0d0-d96a8fa20ea3",
      "name": "Fetch Extension (Manual)",
      "type": "n8n-nodes-base.redis",
      "position": [
        -3568,
        -560
      ]
    },
    {
      "id": "bddaab45-8be7-4500-899a-902278f27226",
      "name": "Video Merge1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4048,
        -608
      ],
      "parameters": {
        "width": 1104,
        "height": 208,
        "content": "**Manual-Merge** — Send original + extended video for manual merge"
      }
    },
    {
      "id": "0f0f19a9-de86-48cb-9fac-7b8e725d2b0f",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4720,
        -2416
      ],
      "parameters": {
        "width": 496,
        "height": 384,
        "content": "[![Workflow Demo Video](https://img.youtube.com/vi/OI_oJ_2F1O0/hqdefault.jpg)](https://youtu.be/OI_oJ_2F1O0)\n"
      }
    }
  ],
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Send Prompt Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "No Photo": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Has Photo?": {
      "main": [
        [
          {
            "node": "Get Photo URL",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Photo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Task ID": {
      "main": [
        [
          {
            "node": "Store Generating Session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Balance OK?": {
      "main": [
        [
          {
            "node": "Start Video Generation",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Insufficient Balance",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Session": {
      "main": [
        [
          {
            "node": "Parse Session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route Input": {
      "main": [
        [
          {
            "node": "Extract Input",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Parse Model Selection",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Parse Publish",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Parse Cancel",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Help",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Parse Extend",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Parse TikTok",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Parse Instagram",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Parse PublishAll",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Parse AutoMerge",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Parse ManualMerge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Cancel": {
      "main": [
        [
          {
            "node": "Answer Cancel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Extend": {
      "main": [
        [
          {
            "node": "Answer Extend",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse TikTok": {
      "main": [
        [
          {
            "node": "Answer TikTok",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Answer Cancel": {
      "main": [
        [
          {
            "node": "Delete Session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Answer Extend": {
      "main": [
        [
          {
            "node": "Get Session (Extend)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Answer TikTok": {
      "main": [
        [
          {
            "node": "Send TikTok Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Balance": {
      "main": [
        [
          {
            "node": "Validate Balance",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Failed?": {
      "main": [
        [
          {
            "node": "Send Merge Failed",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Still Executing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Input": {
      "main": [
        [
          {
            "node": "Has Photo?",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Initial Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Photo URL": {
      "main": [
        [
          {
            "node": "Build Photo URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Publish": {
      "main": [
        [
          {
            "node": "Answer Publish",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Session": {
      "main": [
        [
          {
            "node": "Check Balance",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store Session": {
      "main": [
        [
          {
            "node": "Send Prompt for Approval",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Answer Publish": {
      "main": [
        [
          {
            "node": "Get Session (Publish)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete Session": {
      "main": [
        [
          {
            "node": "Send Cancel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Video": {
      "main": [
        [
          {
            "node": "Upload to YouTube",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Results": {
      "main": [
        [
          {
            "node": "Update Session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Session": {
      "main": [
        [
          {
            "node": "Store Session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Merge URLs": {
      "main": [
        [
          {
            "node": "Send Merging Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Session": {
      "main": [
        [
          {
            "node": "Send Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Merge": {
      "main": [
        [
          {
            "node": "Poll Assembly Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Answer Generate": {
      "main": [
        [
          {
            "node": "Get Session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Photo URL": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Determine Route": {
      "main": [
        [
          {
            "node": "Route Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Manual URLs": {
      "main": [
        [
          {
            "node": "Send Manual Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Complete?": {
      "main": [
        [
          {
            "node": "Download Merged Video",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Check Failed?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AutoMerge": {
      "main": [
        [
          {
            "node": "Fetch Original Session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Instagram": {
      "main": [
        [
          {
            "node": "Answer Instagram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Still Executing": {
      "main": [
        [
          {
            "node": "Wait for Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Answer Instagram": {
      "main": [
        [
          {
            "node": "Send Instagram Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse PublishAll": {
      "main": [
        [
          {
            "node": "Answer PublishAll",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Determine Route",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Balance": {
      "main": [
        [
          {
            "node": "Balance OK?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Answer PublishAll": {
      "main": [
        [
          {
            "node": "Send PublishAll Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse ManualMerge": {
      "main": [
        [
          {
            "node": "Fetch Original (Manual)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Publish to TikTok": {
      "main": [
        [
          {
            "node": "Send TikTok Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to YouTube": {
      "main": [
        [
          {
            "node": "Format Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Extend Task ID": {
      "main": [
        [
          {
            "node": "Store Extending Session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extend Balance OK?": {
      "main": [
        [
          {
            "node": "Generate Extend Prompt",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Insufficient Extend Balance",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Prompt Status": {
      "main": [
        [
          {
            "node": "Generate Prompt & Metadata",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send TikTok Status": {
      "main": [
        [
          {
            "node": "Get Session (TikTok)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Extend Prompt": {
      "main": [
        [
          {
            "node": "Start Extend Generation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Merging Status": {
      "main": [
        [
          {
            "node": "Create Transloadit Assembly",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Merged to S3": {
      "main": [
        [
          {
            "node": "Get Original Session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Extend Balance": {
      "main": [
        [
          {
            "node": "Validate Extend Balance",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Merge Complete": {
      "main": [
        [
          {
            "node": "Merge Complete?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Original Session": {
      "main": [
        [
          {
            "node": "Create Merged Session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Session (Extend)": {
      "main": [
        [
          {
            "node": "Parse Session (Extend)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Session (TikTok)": {
      "main": [
        [
          {
            "node": "Prepare KIE Request (TikTok)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Poll Assembly Status": {
      "main": [
        [
          {
            "node": "Check Merge Complete",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Publish to Instagram": {
      "main": [
        [
          {
            "node": "Send Instagram Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store Merged Session": {
      "main": [
        [
          {
            "node": "Download Merged for Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Merged Session": {
      "main": [
        [
          {
            "node": "Store Merged Session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Merged Video": {
      "main": [
        [
          {
            "node": "Prepare Merged Session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Session (Publish)": {
      "main": [
        [
          {
            "node": "Parse Session (Publish)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Model Selection": {
      "main": [
        [
          {
            "node": "Answer Generate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Extending Status": {
      "main": [
        [
          {
            "node": "Trigger Extend Polling",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Instagram Status": {
      "main": [
        [
          {
            "node": "Get Session (Instagram)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Original Session": {
      "main": [
        [
          {
            "node": "Fetch Extension Session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Extend Prompt": {
      "main": [
        [
          {
            "node": "Parse Extend Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Session (Extend)": {
      "main": [
        [
          {
            "node": "Check Extend Balance",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Merged Session": {
      "main": [
        [
          {
            "node": "Upload Merged to S3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Generating Status": {
      "main": [
        [
          {
            "node": "Trigger Polling",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send PublishAll Status": {
      "main": [
        [
          {
            "node": "Get Session (PublishAll)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start Video Generation": {
      "main": [
        [
          {
            "node": "Add Task ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Extension Session": {
      "main": [
        [
          {
            "node": "Get Merge URLs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Original (Manual)": {
      "main": [
        [
          {
            "node": "Fetch Extension (Manual)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Session (Instagram)": {
      "main": [
        [
          {
            "node": "Prepare KIE Request (Instagram)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Assembly Response": {
      "main": [
        [
          {
            "node": "Wait for Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Session (Publish)": {
      "main": [
        [
          {
            "node": "Download Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start Extend Generation": {
      "main": [
        [
          {
            "node": "Add Extend Task ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store Extending Session": {
      "main": [
        [
          {
            "node": "Send Extending Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Extend Balance": {
      "main": [
        [
          {
            "node": "Extend Balance OK?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Extension (Manual)": {
      "main": [
        [
          {
            "node": "Get Manual URLs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Video URL (TikTok)": {
      "main": [
        [
          {
            "node": "Prepare Publish (TikTok)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Session (PublishAll)": {
      "main": [
        [
          {
            "node": "Prepare KIE Request (PublishAll)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Publish (TikTok)": {
      "main": [
        [
          {
            "node": "Publish to TikTok",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Publish to All Platforms": {
      "main": [
        [
          {
            "node": "Send PublishAll Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store Generating Session": {
      "main": [
        [
          {
            "node": "Send Generating Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Prompt & Metadata": {
      "main": [
        [
          {
            "node": "Format Session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Transloadit Assembly": {
      "main": [
        [
          {
            "node": "Parse Assembly Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Video URL (Instagram)": {
      "main": [
        [
          {
            "node": "Prepare Publish (Instagram)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Publish (Instagram)": {
      "main": [
        [
          {
            "node": "Publish to Instagram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Merged for Telegram": {
      "main": [
        [
          {
            "node": "Send Merged Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Video URL (PublishAll)": {
      "main": [
        [
          {
            "node": "Prepare Publish (PublishAll)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare KIE Request (TikTok)": {
      "main": [
        [
          {
            "node": "Fetch Video URL (TikTok)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Publish (PublishAll)": {
      "main": [
        [
          {
            "node": "Publish to All Platforms",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare KIE Request (Instagram)": {
      "main": [
        [
          {
            "node": "Fetch Video URL (Instagram)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare KIE Request (PublishAll)": {
      "main": [
        [
          {
            "node": "Fetch Video URL (PublishAll)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}