{
  "name": "Create YouTube videos daily from Google Sheets using MagicHour + Gemini",
  "nodes": [
    {
      "id": "db899b52-e3ef-4902-aef7-d00d768604fa",
      "name": "Sheet Row Added",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        -2368,
        240
      ]
    },
    {
      "id": "e0d4bd28-2dc5-4a21-b032-f9662aaf9224",
      "name": "Chat Input",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -1888,
        432
      ]
    },
    {
      "id": "6298a14e-cf94-44b7-89cd-7ee04261fe68",
      "name": "Normalize Input",
      "type": "n8n-nodes-base.set",
      "position": [
        -1696,
        320
      ]
    },
    {
      "id": "e3ff7b59-a0d7-4d3b-98dc-2508c79d4c21",
      "name": "Generate Video Parameters",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -1472,
        320
      ]
    },
    {
      "id": "e1ab9b74-77e1-495c-b17d-1c165f6edd02",
      "name": "Video Params Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -1312,
        544
      ]
    },
    {
      "id": "3fa0edce-0495-4cd6-b684-d71b02db889d",
      "name": "Create Video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1120,
        320
      ]
    },
    {
      "id": "52246df7-31a1-4b16-a64b-e7aa83505dda",
      "name": "Initialize Retry Counter",
      "type": "n8n-nodes-base.set",
      "position": [
        -896,
        320
      ]
    },
    {
      "id": "0d180549-7797-4676-a536-e71b9e23d44e",
      "name": "Check Video Status",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -672,
        320
      ]
    },
    {
      "id": "ca6c413d-e2a4-4ff9-a49c-164e4a204d15",
      "name": "Video Complete?",
      "type": "n8n-nodes-base.if",
      "position": [
        -448,
        304
      ]
    },
    {
      "id": "526d14c8-8a6f-495e-b90d-885652ffce9b",
      "name": "Wait & Retry",
      "type": "n8n-nodes-base.wait",
      "position": [
        -224,
        496
      ]
    },
    {
      "id": "b2732e93-2aa5-4631-bcf3-a02b685cd962",
      "name": "Download Video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -224,
        160
      ]
    },
    {
      "id": "6660692e-54a6-4b75-9faf-59bfeedd0070",
      "name": "Prepare Metadata",
      "type": "n8n-nodes-base.set",
      "position": [
        0,
        304
      ]
    },
    {
      "id": "8f92cd49-26a2-4f05-a24e-54c03bd1c019",
      "name": "Generate YouTube Data",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        224,
        304
      ]
    },
    {
      "id": "0eeffa8c-9896-42b9-a402-18d07d1de200",
      "name": "YouTube JSON Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        368,
        528
      ]
    },
    {
      "id": "9ddabdd7-c757-4271-9990-e9edf69d8b83",
      "name": "Prepare Sheet Update",
      "type": "n8n-nodes-base.set",
      "position": [
        1248,
        160
      ]
    },
    {
      "id": "f02805ee-fc64-4ea9-ab20-27c765c24fef",
      "name": "Update Results",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1472,
        160
      ]
    },
    {
      "id": "42be420e-d832-4e24-a4c8-048d10991d6c",
      "name": "Gemini AI Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        240,
        528
      ]
    },
    {
      "id": "abb1a3f1-4f7c-4d0e-9636-43fc09703208",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -1472,
        544
      ]
    },
    {
      "id": "36aca885-9df1-45e0-b729-95c319acaa0f",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        592,
        160
      ]
    },
    {
      "id": "324140f6-6443-4734-b9ea-fdee1b3f5b9d",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        0,
        560
      ]
    },
    {
      "id": "2d74bb48-2c46-4af6-8e6c-071db4ddd660",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        -2144,
        240
      ]
    },
    {
      "id": "abbb3edf-0de7-4264-9766-c3088be7270a",
      "name": "Limit",
      "type": "n8n-nodes-base.limit",
      "position": [
        -1920,
        224
      ]
    },
    {
      "id": "92e396db-e6bb-4277-b8a3-a9470df8f77a",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        800,
        160
      ]
    },
    {
      "id": "775fd4f0-074e-4780-b133-be549e6cf36f",
      "name": "Upload a video",
      "type": "n8n-nodes-base.youTube",
      "position": [
        1024,
        160
      ]
    },
    {
      "id": "97029081-9c96-4050-a4c1-6d474b349a03",
      "name": "MixAudio audio",
      "type": "n8n-nodes-mediafx.mediaFX",
      "position": [
        288,
        0
      ]
    },
    {
      "id": "0723650f-fe54-47ed-9bac-7521cd061fa4",
      "name": "Code in JavaScript",
      "type": "n8n-nodes-base.code",
      "position": [
        0,
        0
      ]
    },
    {
      "id": "0f8f6cd3-920c-4c8c-8638-c927dfedd7c2",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2496,
        368
      ],
      "parameters": {
        "width": 352,
        "height": 544,
        "content": "Google Sheet Should have  Youtube URL, Youtube Title, Youtube Tags, Youtube Description, Download URL, and matches by the original Prompt value to update the correct row.\n\nFor Shorts, the user only ne"
      }
    },
    {
      "id": "a785fb65-46db-45ed-a4f3-999efed0c8cf",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1568,
        672
      ],
      "parameters": {
        "width": 288,
        "height": 176,
        "content": "Create a key in Google AI Studio (or set up Vertex AI + API key/service account).\nIn n8n → Credentials → Google PaLM/Gemini: paste your API key.\nSelect this credential in the Gemini model nodes used b"
      }
    },
    {
      "id": "58d63a90-befa-44ca-8649-b918943239fd",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1104,
        496
      ],
      "parameters": {
        "width": 528,
        "height": 272,
        "content": "Sign up / log in to MagicHour and open the Developer/API dashboard.\nCreate an API key. Copy it safely (some dashboards display a secret only once).\nIn n8n → Credentials → New → HTTP Bearer YOUR_TOKEN_"
      }
    },
    {
      "id": "cede0ba1-9b30-4467-9cde-9a54ebd6f8d3",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        336
      ],
      "parameters": {
        "width": 320,
        "height": 256,
        "content": "In the same Google Cloud project, enable YouTube Data API v3.\nCreate OAuth client credentials (Web application) and use the same n8n redirect URI.\nIn n8n → Credentials → YouTube OAuth2: authorize with"
      }
    },
    {
      "id": "38203cda-bb9a-44d5-b125-e5c009206c95",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        224,
        -144
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": "this is free audio which can only work if you have n8n pro or host it on your PC \n\ncan change music as you like"
      }
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Upload a video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit": {
      "main": [
        [
          {
            "node": "Normalize Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Chat Input": {
      "main": [
        [
          {
            "node": "Normalize Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Check Video Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Video": {
      "main": [
        [
          {
            "node": "Initialize Retry Counter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait & Retry": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Video": {
      "main": [
        [
          {
            "node": "Prepare Metadata",
            "type": "main",
            "index": 0
          },
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "MixAudio audio": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Upload a video": {
      "main": [
        [
          {
            "node": "Prepare Sheet Update",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini AI Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate YouTube Data",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Input": {
      "main": [
        [
          {
            "node": "Generate Video Parameters",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sheet Row Added": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Video Complete?": {
      "main": [
        [
          {
            "node": "Download Video",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait & Retry",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Metadata": {
      "main": [
        [
          {
            "node": "Generate YouTube Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Video Status": {
      "main": [
        [
          {
            "node": "Video Complete?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "MixAudio audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Video Params Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Generate Video Parameters",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "YouTube JSON Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Generate YouTube Data",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Sheet Update": {
      "main": [
        [
          {
            "node": "Update Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate YouTube Data": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Video Parameters",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Initialize Retry Counter": {
      "main": [
        [
          {
            "node": "Check Video Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Video Parameters": {
      "main": [
        [
          {
            "node": "Create Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}