{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "030e64f9-8abc-4d59-9895-ca91c15176ac",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2368,
        1232
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "3af14c68-f125-4b10-aba4-7e2b3f7d5b87",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1808,
        2016
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "4da0cdb8-02df-48ec-8ebe-1f54432d40e0",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1328,
        2016
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "ddb5c759-522e-4822-8f3a-54c714027512",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -656,
        2016
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "d5f64907-de68-4343-834c-fa11f4d29ff9",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -208,
        2000
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "cdc7c5d2-7bd3-4156-9ea8-82d95ecd31ac",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        2016
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "c9f48cb6-d9eb-4498-984e-6b6c45139486",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1136,
        2016
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "46ca1188-e4dc-40b4-abce-6442e186a847",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2400,
        1936
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "c9ace50b-c281-4c5a-b8c0-456424ed4691",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1168,
        1232
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "3aaa4a6e-9a8e-4e75-8786-c1fe18470c53",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        608,
        1312
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "6a7b888b-3d4c-4a36-89da-06af11b5e570",
      "name": "Set API Credentials",
      "type": "n8n-nodes-base.set",
      "position": [
        -1280,
        2128
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "94277e12-8a13-44b5-9ce3-b9857ce53ca3",
      "name": "Generate JWT Token",
      "type": "n8n-nodes-base.jwt",
      "position": [
        -1056,
        2128
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "25b4094e-2f34-4476-a5e9-aa54336f82c1",
      "name": "Request OAuth Token",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -832,
        2128
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "f388cd42-f846-416b-a305-7c6387d87a89",
      "name": "Extract Data from File",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        -384,
        2128
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d59a0f6f-517b-4e66-8982-50b26a288ec3",
      "name": "Post Video for Analysis",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        64,
        2128
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "44f7d5f0-1fdf-429f-88f4-f994d4621f14",
      "name": "Select Key Moments with AI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        288,
        2128
      ],
      "parameters": {},
      "typeVersion": 1.8
    },
    {
      "id": "2cc6a2a6-e0ae-488c-8d50-b49a0fe34bd2",
      "name": "Split Moments into Items",
      "type": "n8n-nodes-base.code",
      "position": [
        688,
        2128
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "cc24da15-5a34-4e2b-b636-a783b0c245e7",
      "name": "Batch Process Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        656,
        1824
      ],
      "parameters": {},
      "typeVersion": 3
    },
    {
      "id": "4e3e1473-2f1d-49ac-8f97-8258fa4a1774",
      "name": "Route Based on Status",
      "type": "n8n-nodes-base.switch",
      "position": [
        3120,
        2128
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "f11aa68e-a181-42e6-a4eb-9fe56eae1c95",
      "name": "Post to Video Generation API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2448,
        2128
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "2312d0a9-f38a-443b-adc6-15a04cf81736",
      "name": "Post to Check Status API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2896,
        2048
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "32415dbc-c80d-4d15-9bfe-8341271a2e73",
      "name": "Wait 20 Seconds",
      "type": "n8n-nodes-base.wait",
      "position": [
        2672,
        2128
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "d88d16e0-4309-4218-9b22-ab8f92553f75",
      "name": "Convert Data to File",
      "type": "n8n-nodes-base.convertToFile",
      "notes": "At this step, the video should be generated and ready to convert to 9:16 aspect ratio",
      "position": [
        3408,
        1744
      ],
      "parameters": {},
      "notesInFlow": true,
      "typeVersion": 1.1
    },
    {
      "id": "829b3004-95cb-453d-a79a-25d77ed6313e",
      "name": "Upload File to GCS",
      "type": "n8n-nodes-base.googleCloudStorage",
      "position": [
        3648,
        1744
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 1,
      "waitBetweenTries": 2000
    },
    {
      "id": "b7e5a6ce-49ce-4b34-abd3-06522684a145",
      "name": "Set Unique File Name",
      "type": "n8n-nodes-base.set",
      "position": [
        1552,
        2128
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "eea52d69-cb9e-4037-98ce-16516125210c",
      "name": "Set Project Details",
      "type": "n8n-nodes-base.set",
      "position": [
        1776,
        2128
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "0965a3a0-a0e2-472a-b246-916c54a3be3c",
      "name": "Generate JWT for Video",
      "type": "n8n-nodes-base.jwt",
      "position": [
        2000,
        2128
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "4b967d97-2c08-48c1-a09f-0a796b38ba62",
      "name": "Request OAuth Token Again",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2224,
        2128
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "3e2ed6cd-da90-4cce-ba07-49ad764ce2a6",
      "name": "Aggregate Results",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        960,
        1344
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e2970db5-3e61-4f07-9949-353e01a7de0b",
      "name": "AI B-Roll Selector",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        880,
        1808
      ],
      "parameters": {},
      "typeVersion": 1.8
    },
    {
      "id": "9a02c925-c325-4d18-b826-469dcb3fdfc5",
      "name": "Send Telegram Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1440,
        1344
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "b583cb7d-3e46-4161-9329-070dd7394034",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1760,
        2128
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "18bc5583-6661-446b-b478-b57f7c96b889",
      "name": "Set Video URL",
      "type": "n8n-nodes-base.set",
      "position": [
        -1520,
        2128
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "b23af239-7760-4e72-b904-2e6fbe5ab488",
      "name": "Fetch Video from URL",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -608,
        2128
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "dc32f299-1526-4082-9f71-775549664f81",
      "name": "Prepare Analysis Prompt",
      "type": "n8n-nodes-base.code",
      "position": [
        -160,
        2128
      ],
      "parameters": {},
      "typeVersion": 2
    }
  ],
  "connections": {
    "Set Video URL": {
      "main": [
        [
          {
            "node": "Set API Credentials",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Set Video URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 20 Seconds": {
      "main": [
        [
          {
            "node": "Post to Check Status API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate Results": {
      "main": [
        [
          {
            "node": "Send Telegram Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI B-Roll Selector": {
      "main": [
        [
          {
            "node": "Set Unique File Name",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate JWT Token": {
      "main": [
        [
          {
            "node": "Request OAuth Token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload File to GCS": {
      "main": [
        [
          {
            "node": "Batch Process Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Batch Process Items": {
      "main": [
        [
          {
            "node": "Aggregate Results",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "AI B-Roll Selector",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Request OAuth Token": {
      "main": [
        [
          {
            "node": "Fetch Video from URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set API Credentials": {
      "main": [
        [
          {
            "node": "Generate JWT Token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Project Details": {
      "main": [
        [
          {
            "node": "Generate JWT for Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert Data to File": {
      "main": [
        [
          {
            "node": "Upload File to GCS",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Video from URL": {
      "main": [
        [
          {
            "node": "Extract Data from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Unique File Name": {
      "main": [
        [
          {
            "node": "Set Project Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route Based on Status": {
      "main": [
        [
          {
            "node": "Convert Data to File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait 20 Seconds",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Data from File": {
      "main": [
        [
          {
            "node": "Prepare Analysis Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate JWT for Video": {
      "main": [
        [
          {
            "node": "Request OAuth Token Again",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post Video for Analysis": {
      "main": [
        [
          {
            "node": "Select Key Moments with AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Analysis Prompt": {
      "main": [
        [
          {
            "node": "Post Video for Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to Check Status API": {
      "main": [
        [
          {
            "node": "Route Based on Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Moments into Items": {
      "main": [
        [
          {
            "node": "Batch Process Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Request OAuth Token Again": {
      "main": [
        [
          {
            "node": "Post to Video Generation API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Select Key Moments with AI": {
      "main": [
        [
          {
            "node": "Split Moments into Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to Video Generation API": {
      "main": [
        [
          {
            "node": "Wait 20 Seconds",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}