{
  "name": "Kenya Documentary Series Upload Workflow",
  "nodes": [
    {
      "parameters": {
        "triggerTimes": {
          "items": [
            {
              "hour": 10,
              "minute": 0
            }
          ],
          "timeZone": "Africa/Nairobi"
        }
      },
      "name": "Cron Trigger",
      "type": "n8n-nodes-base.cron",
      "typeVersion": 1,
      "position": [
        250,
        100
      ]
    },
    {
      "parameters": {
        "fileId": "={{$json[\"episodeScriptFileId\"]}}"
      },
      "name": "Get Script File",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 1,
      "position": [
        450,
        100
      ]
    },
    {
      "parameters": {
        "url": "https://api.texttospeech.service/v1/tts",
        "method": "POST",
        "jsonParameters": true,
        "bodyParametersJson": {
          "text": "={{$node[\"Get Script File\"].json[\"data\"]}}",
          "voice": "en-US-Standard-A"
        }
      },
      "name": "Generate Voice-Over",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        650,
        100
      ]
    },
    {
      "parameters": {
        "url": "https://api.animation.service/v1/render",
        "method": "POST",
        "jsonParameters": true,
        "bodyParametersJson": {
          "script": "={{$node[\"Get Script File\"].json[\"data\"]}}",
          "voiceFile": "={{$node[\"Generate Voice-Over\"].json[\"audioUrl\"]}}",
          "assets": "={{$json[\"episodeAssets\"]}}",
          "template": "documentaryTemplate"
        }
      },
      "name": "Generate Animation",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        850,
        100
      ]
    },
    {
      "parameters": {
        "url": "={{$node[\"Generate Animation\"].json[\"videoUrl\"]}}",
        "method": "GET",
        "responseFormat": "file",
        "downloadPropertyName": "videoFile"
      },
      "name": "Download Video",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        1050,
        100
      ]
    },
    {
      "parameters": {
        "operation": "upload",
        "title": "Kenya\u2019s Key Post-Independence Assassinations \u2013 Episode {{$json[\"episodeNumber\"]}}: {{$json[\"episodeTitle\"]}}",
        "binaryPropertyName": "videoFile",
        "description": "={{$json[\"videoDescription\"]}}",
        "tags": "={{$json[\"videoKeywords\"]}}",
        "publishAt": "={{$json[\"scheduledPublishTime\"]}}",
        "privacyStatus": "unlisted"
      },
      "name": "YouTube Upload",
      "type": "n8n-nodes-base.youtube",
      "typeVersion": 1,
      "position": [
        1250,
        100
      ]
    },
    {
      "parameters": {
        "fileId": "={{$json[\"episodeScriptFileId\"]}}",
        "fields": [
          {
            "field": "UploadStatus",
            "value": "Uploaded"
          },
          {
            "field": "YouTubeUrl",
            "value": "={{$node[\"YouTube Upload\"].json[\"url\"]}}"
          }
        ]
      },
      "name": "Update Log Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 1,
      "position": [
        1450,
        100
      ]
    }
  ],
  "connections": {
    "Cron Trigger": {
      "main": [
        [
          {
            "node": "Get Script File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Script File": {
      "main": [
        [
          {
            "node": "Generate Voice-Over",
            "type": "main",
            "index": 0
          },
          {
            "node": "Generate Animation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Voice-Over": {
      "main": [
        [
          {
            "node": "Generate Animation",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Generate Animation": {
      "main": [
        [
          {
            "node": "Download Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Video": {
      "main": [
        [
          {
            "node": "YouTube Upload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "YouTube Upload": {
      "main": [
        [
          {
            "node": "Update Log Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {},
  "versionId": 1
}