{
  "name": "Cygni - YouTube Shorts generator",
  "nodes": [
    {
      "parameters": {
        "content": "## 1. Pick the next idea\nReads the first row whose productionStatus is todo.",
        "width": 960,
        "height": 520,
        "color": 6
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -60,
        -140
      ],
      "id": "978f2caf-07ad-4980-b5e9-205b1896c988",
      "name": "Note:  1. Pick the next idea"
    },
    {
      "parameters": {
        "content": "## 2. Make each scene, one at a time\nImage, then a 5-second clip, then a sound effect. Each step polls until the job is finished instead of waiting a guessed number of minutes.",
        "width": 1640,
        "height": 960,
        "color": 3
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        960,
        -400
      ],
      "id": "74cb14b4-e11a-43a5-9458-e1198eb72a46",
      "name": "Note:  2. Make each scene, one at a time"
    },
    {
      "parameters": {
        "content": "## 3. Render the Short\nCreatomate stitches the three scenes into your template.",
        "width": 1380,
        "height": 560,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        2640,
        -140
      ],
      "id": "9cec234e-bd42-4922-ab30-b00ae0b4c805",
      "name": "Note:  3. Render the Short"
    },
    {
      "parameters": {
        "content": "## 4. Publish and report\nUploads privately, updates the sheet and emails you the result.",
        "width": 1420,
        "height": 620,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        4060,
        -260
      ],
      "id": "958d367c-5f0d-4344-b6dd-49aac86bedcd",
      "name": "Note:  4. Publish and report"
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 9
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        0
      ],
      "id": "a755df58-6d3c-4bc0-9ab6-467b3001cf6c",
      "name": "Every day at 9am"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "https://docs.google.com/spreadsheets/d/YOUR_SHEET_ID/edit",
          "mode": "url"
        },
        "sheetName": {
          "__rl": true,
          "value": "Sheet1",
          "mode": "name"
        },
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "productionStatus",
              "lookupValue": "todo"
            }
          ]
        },
        "options": {
          "returnFirstMatch": true
        }
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        220,
        0
      ],
      "id": "792553ef-d080-4fa1-8f3c-acf648b9e74e",
      "name": "Next Idea"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.idea }}",
        "hasOutputParser": true,
        "messages": {
          "messageValues": [
            {
              "message": "You write the beats for a 15-second vertical video told entirely from the viewer's own eyes.\n\nTake the idea you are given and return exactly three beats, in order. Together they must tell one small story: the first sets the scene, the second raises the stakes, the third pays it off. A viewer should be able to follow it with the sound off.\n\nRules for every beat:\n- Five to ten words.\n- One physical action the viewer is doing with their hands, happening right now.\n- Concrete and filmable: something a camera strapped to the viewer's head would actually capture.\n- No quotation marks, no numbering, no emoji, no hashtags.\n- Nothing about getting dressed, sleeping or waking, and nothing that needs a close-up of feet, because video models render those badly.\n\nReturn only the three beats, one per line."
            }
          ]
        }
      },
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.6,
      "position": [
        440,
        0
      ],
      "id": "7e7b6265-ff8e-46db-b716-ade37411c46e",
      "name": "Scene Writer"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-4o",
          "mode": "list",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        380,
        220
      ],
      "id": "0dee1364-46c4-4f36-8f9a-5e0018f55bee",
      "name": "OpenAI Chat Model"
    },
    {
      "parameters": {
        "options": {
          "numberOfItems": 3
        }
      },
      "type": "@n8n/n8n-nodes-langchain.outputParserItemList",
      "typeVersion": 1,
      "position": [
        560,
        220
      ],
      "id": "e206b4c2-4db6-46be-96fd-bed8fa7743de",
      "name": "Three Beats"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        760,
        0
      ],
      "id": "c9dcd1a4-6159-47f8-8d52-e1b3afccaae8",
      "name": "One Scene at a Time"
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "gpt-4o",
          "mode": "list",
          "cachedResultName": "GPT-4O"
        },
        "messages": {
          "values": [
            {
              "content": "=Turn one beat of a first-person video into a single prompt for a photorealistic image model. The image becomes the first frame of a 5-second clip, so it has to look like a real moment caught mid-action.\n\nThe beat: {{ $json.text }}\nThe visual style for the whole video: {{ $('Next Idea').first().json.style }}\n\nWrite one sentence, under 800 characters, that:\n- Opens with: First-person POV, head-mounted camera, vertical 9:16 frame,\n- Puts the viewer's own hands in the lower third of the frame, doing the action in the beat.\n- Then describes the surroundings behind the hands: light, weather, textures, and one detail that sets the place apart.\n- Names one sense beyond sight, like heat, spray or wind, so the frame feels lived in.\n\nKeep it safe for work and free of real people, brands and logos. Return the prompt only, with no preamble, labels or quotation marks."
            }
          ]
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [
        1040,
        -260
      ],
      "id": "9687b563-4491-4742-8e7e-eff0d9667162",
      "name": "Image Prompt"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.piapi.ai/api/v1/task",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {},
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ model: 'Qubico/flux1-dev', task_type: 'txt2img', input: { prompt: $json.message.content, width: 540, height: 960 } }) }}"
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1260,
        -260
      ],
      "id": "9dd2d17b-74e7-4f44-bccf-05faaca57bca",
      "name": "Start Image"
    },
    {
      "parameters": {
        "amount": 20,
        "unit": "seconds"
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        1480,
        -260
      ],
      "id": "6a521972-9ea2-4b66-a12d-76440f77a701",
      "name": "Wait for Image"
    },
    {
      "parameters": {
        "method": "GET",
        "url": "=https://api.piapi.ai/api/v1/task/{{ $json.data.task_id }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1700,
        -260
      ],
      "id": "fca628ff-ac10-4024-8d04-4f8edf6d22a0",
      "name": "Check Image"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "5b56d861-e93c-41f3-b8ce-78c6e56fbed4",
              "leftValue": "={{ $json.data.status }}",
              "rightValue": "completed",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1920,
        -260
      ],
      "id": "56e5fbd3-6dea-4d0d-a187-b18230083d98",
      "name": "Image Done?"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "7c131866-842f-4054-af44-c5364df3436a",
              "leftValue": "={{ $json.data.status }}",
              "rightValue": "failed",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        2140,
        -140
      ],
      "id": "b6a8692a-c18e-4c98-a39a-adc6ddb4c613",
      "name": "Image Failed?"
    },
    {
      "parameters": {
        "errorMessage": "={{ 'PiAPI image task failed: ' + JSON.stringify($json.data.error) }}"
      },
      "type": "n8n-nodes-base.stopAndError",
      "typeVersion": 1,
      "position": [
        2360,
        -140
      ],
      "id": "e846164b-2c5d-4fee-870b-786078061d71",
      "name": "Stop: Image Failed"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.piapi.ai/api/v1/task",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {},
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ model: 'kling', task_type: 'video_generation', input: { prompt: $('Image Prompt').item.json.message.content, negative_prompt: 'blurry, distorted hands, text, watermark', cfg_scale: 0.5, duration: 5, mode: 'std', image_url: $json.data.output.image_url } }) }}"
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1040,
        60
      ],
      "id": "022ef582-836c-4e60-af2a-4ff232931810",
      "name": "Start Video"
    },
    {
      "parameters": {
        "amount": 45,
        "unit": "seconds"
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        1260,
        60
      ],
      "id": "c2234076-037f-410e-afce-18184ede26cd",
      "name": "Wait for Video"
    },
    {
      "parameters": {
        "method": "GET",
        "url": "=https://api.piapi.ai/api/v1/task/{{ $json.data.task_id }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1480,
        60
      ],
      "id": "ed4b594c-887a-4c5f-b4a6-8fdc1a825004",
      "name": "Check Video"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "73984c9f-68ce-48e2-848f-022cd330024a",
              "leftValue": "={{ $json.data.status }}",
              "rightValue": "completed",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1700,
        60
      ],
      "id": "e884abb0-e91b-4d1c-ae51-a68e55a02a68",
      "name": "Video Done?"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "fa54cb6a-c5d3-4520-bfb9-d0615e2c0ea1",
              "leftValue": "={{ $json.data.status }}",
              "rightValue": "failed",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1920,
        180
      ],
      "id": "677ec54e-3d85-49b2-a535-90fa23ca9f97",
      "name": "Video Failed?"
    },
    {
      "parameters": {
        "errorMessage": "={{ 'PiAPI video task failed: ' + JSON.stringify($json.data.error) }}"
      },
      "type": "n8n-nodes-base.stopAndError",
      "typeVersion": 1,
      "position": [
        2140,
        180
      ],
      "id": "9034ee27-ee07-41da-8d5d-d4a3615c6435",
      "name": "Stop: Video Failed"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.elevenlabs.io/v1/sound-generation",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ text: 'Ambient sound effects only, no voice, no music: ' + $('One Scene at a Time').item.json.text, duration_seconds: 5, prompt_influence: 0.5 }) }}"
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1040,
        380
      ],
      "id": "7299b37c-9e33-4708-b440-5a1ce60a4a1f",
      "name": "Scene Sound"
    },
    {
      "parameters": {
        "name": "={{ 'scene-' + $('Check Video').item.json.data.task_id + '.mp3' }}",
        "driveId": {
          "__rl": true,
          "value": "My Drive",
          "mode": "list",
          "cachedResultName": "My Drive"
        },
        "folderId": {
          "__rl": true,
          "value": "https://drive.google.com/drive/folders/YOUR_FOLDER_ID",
          "mode": "url"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        1260,
        380
      ],
      "id": "4d66d3f0-644a-46cc-b42f-6041ab7a6d9f",
      "name": "Save Sound"
    },
    {
      "parameters": {
        "operation": "share",
        "fileId": {
          "__rl": true,
          "value": "={{ $json.id }}",
          "mode": "id"
        },
        "permissionsUi": {
          "permissionsValues": {
            "role": "reader",
            "type": "anyone"
          }
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        1480,
        380
      ],
      "id": "06154cc8-8d94-4454-8570-341a0c1aa7b6",
      "name": "Share Sound"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "2cd41b86-4ff1-4877-ab71-92db3147b676",
              "name": "title",
              "value": "={{ $('One Scene at a Time').item.json.text }}",
              "type": "string"
            },
            {
              "id": "f2bc3b6a-3d13-4f18-a2cd-473326f00cd5",
              "name": "videoUrl",
              "value": "={{ $('Check Video').item.json.data.output.video || $('Check Video').item.json.data.output.works?.[0]?.video?.resource_without_watermark || $('Check Video').item.json.data.output.works?.[0]?.video?.resource || $('Check Video').item.json.data.output.video_url }}",
              "type": "string"
            },
            {
              "id": "1a268726-885e-4122-81d9-0890c423a930",
              "name": "soundUrl",
              "value": "={{ $('Save Sound').item.json.webContentLink }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1700,
        380
      ],
      "id": "baa93dac-656b-483e-9acd-fdb35d876f44",
      "name": "Collect Scene"
    },
    {
      "parameters": {
        "jsCode": "// One Creatomate modification set for all three scenes.\n// Element names must match the template: Video-1..3, Audio-1..3, Text-1..3.\nconst scenes = $input.all().map((item) => item.json);\nconst modifications = {};\nscenes.forEach((scene, i) => {\n  const n = i + 1;\n  modifications[`Video-${n}.source`] = scene.videoUrl;\n  modifications[`Audio-${n}.source`] = scene.soundUrl;\n  modifications[`Text-${n}.text`] = scene.title;\n});\nreturn [{ json: { modifications } }];\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        2700,
        0
      ],
      "id": "053f5346-6a5d-44eb-9626-775f430bc205",
      "name": "Build Render"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.creatomate.com/v1/renders",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {},
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ template_id: 'YOUR_CREATOMATE_TEMPLATE_ID', modifications: $json.modifications }) }}"
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        2920,
        0
      ],
      "id": "1c8efab7-506d-4ec7-89ba-2419d187d7f9",
      "name": "Start Render"
    },
    {
      "parameters": {
        "amount": 15,
        "unit": "seconds"
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        3140,
        0
      ],
      "id": "e7d9d8cd-b3d2-40ff-8653-47494b2b1816",
      "name": "Wait for Render"
    },
    {
      "parameters": {
        "method": "GET",
        "url": "=https://api.creatomate.com/v1/renders/{{ $json.id }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        3360,
        0
      ],
      "id": "2263ccba-6657-4f0e-b7e2-5a4175c8b241",
      "name": "Check Render"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "5460e8e3-042d-4d71-ab2b-6584ce38ef3d",
              "leftValue": "={{ $json.status }}",
              "rightValue": "succeeded",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        3580,
        0
      ],
      "id": "e53ebe8e-bbdd-4f49-84b6-6df172b03e9b",
      "name": "Render Done?"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "24b28250-59f0-4a88-ab7b-c649045953e3",
              "leftValue": "={{ $json.status }}",
              "rightValue": "failed",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        3580,
        240
      ],
      "id": "72f38873-170c-4a06-9959-bc5fae3bc5c2",
      "name": "Render Failed?"
    },
    {
      "parameters": {
        "errorMessage": "={{ 'Creatomate render failed: ' + $json.error_message }}"
      },
      "type": "n8n-nodes-base.stopAndError",
      "typeVersion": 1,
      "position": [
        3800,
        240
      ],
      "id": "fcd6621c-9f5f-4a3a-a866-ed6e6e6af9f6",
      "name": "Stop: Render Failed"
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "https://docs.google.com/spreadsheets/d/YOUR_SHEET_ID/edit",
          "mode": "url"
        },
        "sheetName": {
          "__rl": true,
          "value": "Sheet1",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "id": "={{ $('Next Idea').first().json.id }}",
            "videoLink": "={{ $json.url }}",
            "productionStatus": "rendered"
          },
          "matchingColumns": [
            "id"
          ],
          "schema": [
            {
              "id": "id",
              "displayName": "id",
              "required": false,
              "defaultMatch": true,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "title",
              "displayName": "title",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "idea",
              "displayName": "idea",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "caption",
              "displayName": "caption",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "style",
              "displayName": "style",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "productionStatus",
              "displayName": "productionStatus",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "publishStatus",
              "displayName": "publishStatus",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "videoLink",
              "displayName": "videoLink",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "postedToYouTube",
              "displayName": "postedToYouTube",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        4100,
        0
      ],
      "id": "0714322c-734f-4075-9aa4-c0cc9155dc27",
      "name": "Save Video Link"
    },
    {
      "parameters": {
        "url": "={{ $('Check Render').item.json.url }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        4320,
        0
      ],
      "id": "55b75bbc-c515-41bc-825e-9ca75c4c3535",
      "name": "Download Video"
    },
    {
      "parameters": {
        "resource": "video",
        "operation": "upload",
        "title": "={{ $('Next Idea').first().json.title }}",
        "regionCode": "US",
        "categoryId": "24",
        "options": {
          "description": "={{ $('Next Idea').first().json.caption }}",
          "privacyStatus": "private"
        }
      },
      "type": "n8n-nodes-base.youTube",
      "typeVersion": 1,
      "position": [
        4540,
        0
      ],
      "id": "6ab43363-1f22-4a31-9d5c-9e1ac99db65e",
      "name": "Upload to YouTube",
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "a20b1ba8-0b69-45b7-ab9e-10240790214d",
              "leftValue": "={{ $json.uploadId }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        4760,
        0
      ],
      "id": "489cca8e-0fa1-49cd-a7e4-081e9eda4349",
      "name": "Uploaded?"
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "https://docs.google.com/spreadsheets/d/YOUR_SHEET_ID/edit",
          "mode": "url"
        },
        "sheetName": {
          "__rl": true,
          "value": "Sheet1",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "id": "={{ $('Next Idea').first().json.id }}",
            "productionStatus": "complete",
            "publishStatus": "uploaded-private",
            "postedToYouTube": "true"
          },
          "matchingColumns": [
            "id"
          ],
          "schema": [
            {
              "id": "id",
              "displayName": "id",
              "required": false,
              "defaultMatch": true,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "title",
              "displayName": "title",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "idea",
              "displayName": "idea",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "caption",
              "displayName": "caption",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "style",
              "displayName": "style",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "productionStatus",
              "displayName": "productionStatus",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "publishStatus",
              "displayName": "publishStatus",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "videoLink",
              "displayName": "videoLink",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "postedToYouTube",
              "displayName": "postedToYouTube",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        4980,
        -120
      ],
      "id": "ffc6b3e8-5d0a-4a39-9a7b-14a68e9115a8",
      "name": "Mark Uploaded"
    },
    {
      "parameters": {
        "sendTo": "you@example.com",
        "subject": "=Short ready to review: {{ $('Next Idea').first().json.title }}",
        "emailType": "text",
        "message": "=Your Short has been uploaded to YouTube as a private video.\n\nTitle: {{ $('Next Idea').first().json.title }}\nReview it: https://studio.youtube.com/video/{{ $('Uploaded?').item.json.uploadId }}/edit\n\nMake it public from YouTube Studio once you're happy with it.\n\nRendered file: {{ $('Check Render').item.json.url }}",
        "options": {}
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        5200,
        -120
      ],
      "id": "ad63af2b-c8a0-40fb-a73e-0d0515f61d39",
      "name": "Email: Uploaded"
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "https://docs.google.com/spreadsheets/d/YOUR_SHEET_ID/edit",
          "mode": "url"
        },
        "sheetName": {
          "__rl": true,
          "value": "Sheet1",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "id": "={{ $('Next Idea').first().json.id }}",
            "publishStatus": "failed"
          },
          "matchingColumns": [
            "id"
          ],
          "schema": [
            {
              "id": "id",
              "displayName": "id",
              "required": false,
              "defaultMatch": true,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "title",
              "displayName": "title",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "idea",
              "displayName": "idea",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "caption",
              "displayName": "caption",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "style",
              "displayName": "style",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "productionStatus",
              "displayName": "productionStatus",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "publishStatus",
              "displayName": "publishStatus",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "videoLink",
              "displayName": "videoLink",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "postedToYouTube",
              "displayName": "postedToYouTube",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        4980,
        140
      ],
      "id": "cd5c1154-8414-48fc-95c7-a2122a7fbb92",
      "name": "Mark Upload Failed"
    },
    {
      "parameters": {
        "sendTo": "you@example.com",
        "subject": "=Short failed to upload: {{ $('Next Idea').first().json.title }}",
        "emailType": "text",
        "message": "=The video rendered, but the YouTube upload failed.\n\nTitle: {{ $('Next Idea').first().json.title }}\nError: {{ JSON.stringify($('Uploaded?').item.json.error) }}\n\nThe rendered file is still available to upload by hand: {{ $('Check Render').item.json.url }}",
        "options": {}
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        5200,
        140
      ],
      "id": "93d2f356-6e83-4c97-ab10-41d0bf4a21f0",
      "name": "Email: Upload Failed"
    }
  ],
  "pinData": {},
  "connections": {
    "Every day at 9am": {
      "main": [
        [
          {
            "node": "Next Idea",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Next Idea": {
      "main": [
        [
          {
            "node": "Scene Writer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Scene Writer",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Three Beats": {
      "ai_outputParser": [
        [
          {
            "node": "Scene Writer",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Scene Writer": {
      "main": [
        [
          {
            "node": "One Scene at a Time",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "One Scene at a Time": {
      "main": [
        [
          {
            "node": "Build Render",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Image Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Image Prompt": {
      "main": [
        [
          {
            "node": "Start Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start Image": {
      "main": [
        [
          {
            "node": "Wait for Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Image": {
      "main": [
        [
          {
            "node": "Check Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Image": {
      "main": [
        [
          {
            "node": "Image Done?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Image Done?": {
      "main": [
        [
          {
            "node": "Start Video",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Image Failed?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Image Failed?": {
      "main": [
        [
          {
            "node": "Stop: Image Failed",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait for Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start Video": {
      "main": [
        [
          {
            "node": "Wait for Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Video": {
      "main": [
        [
          {
            "node": "Check Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Video": {
      "main": [
        [
          {
            "node": "Video Done?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Video Done?": {
      "main": [
        [
          {
            "node": "Scene Sound",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Video Failed?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Video Failed?": {
      "main": [
        [
          {
            "node": "Stop: Video Failed",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait for Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scene Sound": {
      "main": [
        [
          {
            "node": "Save Sound",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Sound": {
      "main": [
        [
          {
            "node": "Share Sound",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Share Sound": {
      "main": [
        [
          {
            "node": "Collect Scene",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Collect Scene": {
      "main": [
        [
          {
            "node": "One Scene at a Time",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Render": {
      "main": [
        [
          {
            "node": "Start Render",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start Render": {
      "main": [
        [
          {
            "node": "Wait for Render",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Render": {
      "main": [
        [
          {
            "node": "Check Render",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Render": {
      "main": [
        [
          {
            "node": "Render Done?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Render Done?": {
      "main": [
        [
          {
            "node": "Save Video Link",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Render Failed?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Render Failed?": {
      "main": [
        [
          {
            "node": "Stop: Render Failed",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait for Render",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Video Link": {
      "main": [
        [
          {
            "node": "Download Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Video": {
      "main": [
        [
          {
            "node": "Upload to YouTube",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to YouTube": {
      "main": [
        [
          {
            "node": "Uploaded?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Uploaded?": {
      "main": [
        [
          {
            "node": "Mark Uploaded",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Mark Upload Failed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mark Uploaded": {
      "main": [
        [
          {
            "node": "Email: Uploaded",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mark Upload Failed": {
      "main": [
        [
          {
            "node": "Email: Upload Failed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "executionTimeout": 3600
  },
  "tags": []
}
