{
  "meta": {
    "instanceId": "29cf227651b207fca8739269056bd8f95a432c5e246ffae4aaf9220581f6fe53",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "2b7aee06-739e-46f2-969c-a1a595da9a7d",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        0,
        1504
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "39e9de43-a644-4093-b6b6-29ad283f96f4",
      "name": "Get status",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1024,
        1376
      ],
      "parameters": {
        "url": "=https://api.aimlapi.com/v2/generate/video/google/generation",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "generation_id",
              "value": "={{ $json.id }}"
            }
          ]
        }
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "credential-id",
          "name": "httpBearerAuth Credential"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "8a8f5b05-aa67-465a-b8a7-c2f4793bca32",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        1344
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5d98b57e-68e8-4f21-bba9-8131272ab84f",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        32,
        80
      ],
      "parameters": {
        "width": 436,
        "height": 424,
        "content": "## STEP 1: SET UP YOUR GOOGLE SHEET\n\n1. **Create the Sheet**\n   * Copy [this template](https://docs.google.com/spreadsheets/d/1PXFCgY9zKHjX0HEhtrjMMiwefuwUP-bHIbwJ1gc-cAI/edit?usp=sharing)\n\n2. **Configure Inputs**\n   * **PROMPT** column → Enter the exact \n\n3. **Leave Outputs Blank**\n   * **VIDEO** column → Leave empty; your generated video URL will be populated here automatically once creation is complete.\n\n\nWith this sheet in place, you’ll trigger the rest of the workflow—from AI video generation to YouTube upload—directly from these entries."
      },
      "typeVersion": 1
    },
    {
      "id": "5e85bae0-cc0b-4cc5-9dc7-433ee4811b1a",
      "name": "Completed?",
      "type": "n8n-nodes-base.if",
      "position": [
        1248,
        1440
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "383d112e-2cc6-4dd4-8985-f09ce0bd1781",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "completed"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f9c32efc-ce09-4504-9a5a-cd748efdf199",
      "name": "Update result",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2256,
        1344
      ],
      "parameters": {
        "columns": {
          "value": {
            "VIDEO": "={{ $json.webContentLink }}",
            "row_number": "={{ $('Get new video').item.json.row_number }}"
          },
          "schema": [
            {
              "id": "PROMPT",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "PROMPT",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "VIDEO",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "VIDEO",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "YOUTUBE_URL",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "YOUTUBE_URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1PXFCgY9zKHjX0HEhtrjMMiwefuwUP-bHIbwJ1gc-cAI/edit#gid=0",
          "cachedResultName": "Main"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1PXFCgY9zKHjX0HEhtrjMMiwefuwUP-bHIbwJ1gc-cAI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1PXFCgY9zKHjX0HEhtrjMMiwefuwUP-bHIbwJ1gc-cAI/edit?usp=drivesdk",
          "cachedResultName": "Veo3 VideoGen"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "credential-id",
          "name": "googleSheetsOAuth2Api Credential"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "06e62023-79ea-44b0-9f35-76f197177bf7",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        720
      ],
      "parameters": {
        "width": 484,
        "height": 452,
        "content": "## STEP 4: MAIN FLOW\n\n1. **Trigger the Workflow**\n   * You can kick off the process **manually** by clicking **Run** on the **Main Flow**.\n   * **Or** attach a **Schedule Trigger** node to automate execution.\n\n2. **Configure the Schedule Trigger**\n   * Set the interval to **every 5 minutes** for near‑real‑time processing.\n   * Adjust as needed depending on your volume and quota.\n\nOnce the trigger fires, the flow will:\n* Read new rows from your Google Sheet\n* Generate AI videos via Google Veo3\n* Save output to Google Drive\n* Optimize titles with GPT‑4o\n* Upload to YouTube\n* Log results back into the sheet—all hands‑free."
      },
      "typeVersion": 1
    },
    {
      "id": "149c7098-6fae-432c-968c-602fce1ee77b",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        384
      ],
      "parameters": {
        "width": 484,
        "height": 316,
        "content": "## STEP 2: OBTAIN YOUR API KEY\n\n1. **Sign Up & Retrieve Key**\n   * Go to [https://aimlapi.com/app/keys](https://aimlapi.com/app/keys?utm_source=n8n-workflows&utm_medium=github&utm_campaign=integration) \n   * Create or log in to your account and copy your API key.\n\n2. **Configure “Create Image” Node**\n   * **Authentication Type:** Bearer YOUR_TOKEN_HERE\n   * **Header Name:** Authorization\n   * **Header Value:** Key `YOURAPIKEY`\n\nOnce saved, this key will authorize all subsequent calls to the AI/ML API in your workflow."
      },
      "typeVersion": 1
    },
    {
      "id": "21888932-7f64-48b2-81fd-6020e53375be",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        1360
      ],
      "parameters": {
        "width": 246,
        "height": 248,
        "content": "Set API Key created in Step 2"
      },
      "typeVersion": 1
    },
    {
      "id": "e7908696-7ecf-40ed-a500-bd97eae235ba",
      "name": "Get new video",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        240,
        1440
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1PXFCgY9zKHjX0HEhtrjMMiwefuwUP-bHIbwJ1gc-cAI/edit#gid=0",
          "cachedResultName": "Main"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "1PXFCgY9zKHjX0HEhtrjMMiwefuwUP-bHIbwJ1gc-cAI"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "credential-id",
          "name": "googleSheetsOAuth2Api Credential"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "c68b0220-628b-4433-9f6c-9fe669fad481",
      "name": "Upload Video",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1984,
        1344
      ],
      "parameters": {
        "name": "={{ $now.format('yyyy.LL.dd HH-mm-ss') }} {{ $json.content }}.mp4",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive",
          "cachedResultName": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1jwfZcnC1nJvD7Gs9i0ug2mBaVfmqV5FO",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1jwfZcnC1nJvD7Gs9i0ug2mBaVfmqV5FO",
          "cachedResultName": "AI ML API"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "credential-id",
          "name": "googleDriveOAuth2Api Credential"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "a5fd7d46-56ce-4cb4-81fe-6195f5125826",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1984,
        1584
      ],
      "parameters": {
        "url": "https://api.upload-post.com/api/upload",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "title",
              "value": "={{ $('Generate title with AI/ML API').item.json.content }}"
            },
            {
              "name": "user",
              "value": "YOUR_USERNAME"
            },
            {
              "name": "platform[]",
              "value": "youtube"
            },
            {
              "name": "video",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "data"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "eadd3284-83f0-428d-968c-cc6b1af8a42a",
      "name": "Update Youtube URL",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2256,
        1584
      ],
      "parameters": {
        "columns": {
          "value": {
            "row_number": "={{ $('Get new video').item.json.row_number }}",
            "YOUTUBE_URL": "https://youtu.be/{{ $json.results.youtube.video_id }}"
          },
          "schema": [
            {
              "id": "PROMPT",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "PROMPT",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "DURATION",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "DURATION",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "VIDEO",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "VIDEO",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "YOUTUBE_URL",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "YOUTUBE_URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1PXFCgY9zKHjX0HEhtrjMMiwefuwUP-bHIbwJ1gc-cAI/edit#gid=0",
          "cachedResultName": "Main"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1PXFCgY9zKHjX0HEhtrjMMiwefuwUP-bHIbwJ1gc-cAI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1PXFCgY9zKHjX0HEhtrjMMiwefuwUP-bHIbwJ1gc-cAI/edit?usp=drivesdk",
          "cachedResultName": "Veo3 VideoGen"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "credential-id",
          "name": "googleSheetsOAuth2Api Credential"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "54e07216-fc8a-4b96-b462-80cbd0e71e56",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1920,
        1504
      ],
      "parameters": {
        "width": 228,
        "height": 232,
        "content": "Set YOUR_USERNAME in Step 3"
      },
      "typeVersion": 1
    },
    {
      "id": "4d1165e3-c25a-46cd-9465-d4d34a59ff92",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        32,
        528
      ],
      "parameters": {
        "width": 436,
        "height": 520,
        "content": "## STEP 3: CONFIGURE YOUTUBE UPLOAD\n\n1. **Obtain Your Upload-Post API Key**\n   * Sign in at [https://app.upload-post.com/](https://app.upload-post.com/)\n   * Under **Manage API Keys**, copy your key (you get 10 free uploads/month).\n\n2. **Set the Auth Header**\n   * **Header Name:** `Authorization`\n   * **Header Value:** `Apikey YOUR_API_KEY_HERE`\n\n3. **Create & Select a Profile**\n   * In Upload‑Post, create one or more “Profiles” to represent your YouTube accounts.\n   * When configuring the upload node, choose the profile name (e.g. `test1` or `test2`) and insert it into the `YOUR_USRNAME` field.\n\nOnce these are in place, the workflow’s upload node will authenticate and publish videos under the specified profile.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "ef498f17-80b0-4482-82ed-d2f90458e5c8",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        -112
      ],
      "parameters": {
        "color": 3,
        "width": 484,
        "height": 472,
        "content": "**AI Video Automation: Google Veo3 → Google Drive → YouTube**\n\n**This end‑to‑end workflow fully automates your AI video pipeline:**\n\n1. **AI Video Generation**\n   * Trigger video creation with Google Veo3 directly from a Google Sheet.\n\n2. **Save to Google Drive**\n   * Automatically store completed videos in a specified Drive folder.\n\n3. **Title Optimization**\n   * Leverage GPT‑4o to generate SEO‑friendly YouTube titles.\n\n4. **Automatic YouTube Upload**\n   * Publish videos via the YouTube API with metadata populated.\n\n5. **Tracking & Reporting**\n   * Log upload status, video IDs, and performance metrics back into the Sheet."
      },
      "typeVersion": 1
    },
    {
      "id": "12fb7ba2-e048-4cd0-b0d3-f5ac746bcbb2",
      "name": "Generate title with AI/ML API",
      "type": "n8n-nodes-aimlapi.aimlApi",
      "position": [
        1520,
        1440
      ],
      "parameters": {
        "model": "openai/gpt-4o",
        "prompt": "=You are a YouTube SEO expert specialized in creating engaging and optimized titles.\n\nYour task is to generate an effective title for a YouTube video based on the user's video description.\n\nGUIDELINES:\n- Maximum 60 characters to avoid truncation\n- Use relevant keywords for SEO\n- Make the title catchy and clickable\n- Avoid excessive or misleading clickbait\n- Consider the target audience of the content\n- Use numbers, questions, or power words when appropriate\n- IMPORTANT: Generate the title in the same language as the input description\n\nOUTPUT FORMAT:\nProvide only the title, without additional explanations.\n\nEXAMPLE:\nInput: \"Tutorial video on how to cook perfect pasta carbonara\"\nOutput: \"PERFECT Carbonara in 10 Minutes - Chef's Secrets\"\n\nInput: {{ $('Get new video').item.json.PROMPT }}",
        "options": {},
        "requestOptions": {}
      },
      "credentials": {
        "aimlApi": {
          "id": "credential-id",
          "name": "aimlApi Credential"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9b3e4edd-f4ef-4c51-b4db-8cafeeaea697",
      "name": "Create Video with AI/ML API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        544,
        1440
      ],
      "parameters": {
        "url": "https://api.aimlapi.com/v2/generate/video/google/generation",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "prompt",
              "value": "={{ $json.PROMPT }}"
            },
            {
              "name": "model",
              "value": "google/veo3"
            }
          ]
        },
        "genericAuthType": "httpBearerAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "credential-id",
          "name": "httpBearerAuth Credential"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "1bd9bb11-77d8-4138-a6d4-ff13ff5ac02f",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        448,
        1280
      ],
      "parameters": {
        "color": 5,
        "width": 960,
        "height": 432,
        "content": "# Generate Video via VEO-3"
      },
      "typeVersion": 1
    },
    {
      "id": "d33b9412-f38d-40fd-8278-2baf6dfd6383",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1440,
        1280
      ],
      "parameters": {
        "color": 5,
        "width": 246,
        "height": 432,
        "content": "### Generate Title via GPT-4o"
      },
      "typeVersion": 1
    },
    {
      "id": "1a48d18e-952f-4568-a8aa-e51db4e987e3",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1712,
        1216
      ],
      "parameters": {
        "color": 5,
        "width": 726,
        "height": 544,
        "content": "## Upload your video"
      },
      "typeVersion": 1
    },
    {
      "id": "2913cb17-aa57-40e1-9977-a229aa357ab7",
      "name": "Wait 30 sec.",
      "type": "n8n-nodes-base.wait",
      "position": [
        800,
        1440
      ],
      "webhookId": "490facb8-d0ae-402e-ab59-a87720cf0bdd",
      "parameters": {
        "amount": 30
      },
      "typeVersion": 1.1
    },
    {
      "id": "03c75bcc-27d6-496f-964f-17c745dedb40",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        1280
      ],
      "parameters": {
        "color": 5,
        "width": 486,
        "height": 432,
        "content": "### Select your automating settings\n"
      },
      "typeVersion": 1
    },
    {
      "id": "7c727b48-cc78-466f-8260-ad82f53e394a",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1456,
        1360
      ],
      "parameters": {
        "width": 214,
        "height": 232,
        "content": "Set API Key created in Step 2"
      },
      "typeVersion": 1
    },
    {
      "id": "605b0ad0-8bdd-4a6a-94ab-f73562803f53",
      "name": "Get Video File",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1744,
        1440
      ],
      "parameters": {
        "url": "={{ $('Completed?').item.json.video.url }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "13a8afe5-6e36-4881-ad10-b4e40338115f",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1920,
        1264
      ],
      "parameters": {
        "width": 228,
        "height": 232,
        "content": "Create and insert link to your `output` GoogleDrive folder"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Completed?": {
      "main": [
        [
          {
            "node": "Generate title with AI/ML API",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait 30 sec.",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get status": {
      "main": [
        [
          {
            "node": "Completed?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Update Youtube URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Video": {
      "main": [
        [
          {
            "node": "Update result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 30 sec.": {
      "main": [
        [
          {
            "node": "Get status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get new video": {
      "main": [
        [
          {
            "node": "Create Video with AI/ML API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Video File": {
      "main": [
        [
          {
            "node": "Upload Video",
            "type": "main",
            "index": 0
          },
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Video with AI/ML API": {
      "main": [
        [
          {
            "node": "Wait 30 sec.",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate title with AI/ML API": {
      "main": [
        [
          {
            "node": "Get Video File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Get new video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}