{
  "name": "DeloVoiZanos Content Factory",
  "nodes": [
    {
      "parameters": {
        "triggerTimes": {
          "item": [
            {
              "mode": "everyHour"
            }
          ]
        }
      },
      "id": "1",
      "name": "Cron Trigger",
      "type": "n8n-nodes-base.cron",
      "typeVersion": 1,
      "position": [
        -1280,
        100
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "delovoizanos-content-factory",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "2",
      "name": "Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -1280,
        280
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a1",
              "name": "content_type",
              "value": "={{$json.content_type || (Math.random() > 0.5 ? 'warmup' : 'gambling')}}",
              "type": "string"
            },
            {
              "id": "a2",
              "name": "platforms",
              "value": "={{$json.platforms || ['youtube','telegram','tiktok_metadata']}}",
              "type": "array"
            }
          ]
        },
        "options": {}
      },
      "id": "4",
      "name": "Normalize Input",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -860,
        180
      ]
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": false,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{$json.content_type}}",
                    "rightValue": "warmup",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "warmup"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": false,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{$json.content_type}}",
                    "rightValue": "gambling",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "gambling"
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra"
        }
      },
      "id": "5",
      "name": "Choose Branch",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        -660,
        180
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "w1",
              "name": "script_text",
              "value": "=Lifestyle and mindset check-in from DeloVoiZanos: build your routine, stay consistent, and turn neighborhood hustle into focused progress. Today on stream we share practical tips, discipline habits, and how to keep positive momentum.",
              "type": "string"
            },
            {
              "id": "w2",
              "name": "title",
              "value": "=DeloVoiZanos Warmup: Routine, Mindset, Progress",
              "type": "string"
            },
            {
              "id": "w3",
              "name": "description",
              "value": "=Warmup short by DeloVoiZanos on lifestyle, mindset, and stream discipline. #shorts #mindset #streamer",
              "type": "string"
            },
            {
              "id": "w4",
              "name": "short_caption",
              "value": "=Warmup vibes: mindset, routine, and progress with DeloVoiZanos.",
              "type": "string"
            },
            {
              "id": "w5",
              "name": "long_story_text",
              "value": "=",
              "type": "string"
            },
            {
              "id": "w6",
              "name": "branch",
              "value": "=warmup",
              "type": "string"
            },
            {
              "id": "w7",
              "name": "tags",
              "value": "={{['shorts','lifestyle','mindset','streaming','delovoizanos']}}",
              "type": "array"
            }
          ]
        },
        "options": {}
      },
      "id": "6",
      "name": "Warmup Script",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -440,
        80
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "g1",
              "name": "script_text",
              "value": "=DeloVoiZanos stream update: tonight we run slots, bonus hunts, and tournament highlights for entertainment only. We share reactions, fun moments, and community energy\u2014no promises, no guaranteed income, just responsible content.",
              "type": "string"
            },
            {
              "id": "g2",
              "name": "title",
              "value": "=DeloVoiZanos Entertainment Stream: Bonus Hunt Highlights",
              "type": "string"
            },
            {
              "id": "g3",
              "name": "description",
              "value": "=Entertainment-focused stream short: slots and bonus hunt reactions from DeloVoiZanos. No financial guarantees. 18+ Play responsibly. #shorts #stream #entertainment",
              "type": "string"
            },
            {
              "id": "g4",
              "name": "short_caption",
              "value": "=Entertainment-only stream highlights with DeloVoiZanos. Play responsibly.",
              "type": "string"
            },
            {
              "id": "g5",
              "name": "long_story_text",
              "value": "=Tonight's marathon is all about entertainment, reactions, and community moments. This content is not financial advice and does not promise income. If you play, do it responsibly and only for fun.",
              "type": "string"
            },
            {
              "id": "g6",
              "name": "branch",
              "value": "=gambling",
              "type": "string"
            },
            {
              "id": "g7",
              "name": "tags",
              "value": "={{['shorts','stream','entertainment','bonus_hunt','delovoizanos']}}",
              "type": "array"
            }
          ]
        },
        "options": {}
      },
      "id": "7",
      "name": "Gambling Script",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -440,
        280
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.elevenlabs.io/v1/text-to-speech/VOICE_ID_PLACEHOLDER",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "xi-api-key",
              "value": "ELEVENLABS_API_KEY_HERE"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"text\": {{$json.script_text}},\n  \"model_id\": \"eleven_v3\"\n}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file",
              "outputPropertyName": "audio"
            }
          }
        }
      },
      "id": "8",
      "name": "TTS ElevenLabs",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -220,
        180
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "aurl1",
              "name": "audio_url",
              "value": "=https://example.com/path/to/generated-audio.mp3",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "9",
      "name": "Prepare Audio URL",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        0,
        180
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.heygen.com/v2/video/generate",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer HEYGEN_API_KEY_HERE"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"avatar_id\": \"AVATAR_ID_DELOVOIZANOS\",\n  \"voice\": {\n    \"type\": \"upload\",\n    \"audio_url\": {{$json.audio_url}}\n  },\n  \"script\": {{$json.script_text}},\n  \"aspect_ratio\": \"9:16\"\n}",
        "options": {}
      },
      "id": "10",
      "name": "Create HeyGen Video",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        220,
        180
      ]
    },
    {
      "parameters": {
        "amount": 20,
        "unit": "seconds"
      },
      "id": "11",
      "name": "Wait Before Status Check",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        440,
        180
      ]
    },
    {
      "parameters": {
        "method": "GET",
        "url": "=https://api.heygen.com/v2/video/status?video_id={{$json.video_id || $json.data?.video_id}}",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer HEYGEN_API_KEY_HERE"
            }
          ]
        },
        "options": {}
      },
      "id": "12",
      "name": "Check HeyGen Status",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        660,
        180
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": false,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "leftValue": "={{$json.status || $json.data?.status}}",
              "rightValue": "completed",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "13",
      "name": "Video Ready?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        880,
        180
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "pv1",
              "name": "video_url",
              "value": "={{$json.video_url || $json.data?.video_url || $json.url || 'https://example.com/generated-video.mp4'}}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "14",
      "name": "Extract Video URL",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1100,
        100
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://example.com/youtube/upload",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"title\": {{$json.title}},\n  \"description\": {{$json.description}},\n  \"tags\": {{$json.tags}},\n  \"privacyStatus\": \"unlisted\",\n  \"video_url\": {{$json.video_url}}\n}",
        "options": {}
      },
      "id": "15",
      "name": "Publish YouTube",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1320,
        20
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.telegram.org/botTELEGRAM_BOT_TOKEN_HERE/sendVideo",
        "sendBody": true,
        "contentType": "form-urlencoded",
        "bodyParameters": {
          "parameters": [
            {
              "name": "chat_id",
              "value": "TELEGRAM_CHAT_ID_HERE"
            },
            {
              "name": "video",
              "value": "={{$json.video_url}}"
            },
            {
              "name": "caption",
              "value": "={{$json.short_caption}}"
            }
          ]
        },
        "options": {}
      },
      "id": "16",
      "name": "Publish Telegram Video",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1320,
        180
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "leftValue": "={{$json.branch}}",
              "rightValue": "gambling",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "17",
      "name": "Is Gambling Branch?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1320,
        340
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.telegram.org/botTELEGRAM_BOT_TOKEN_HERE/sendMessage",
        "sendBody": true,
        "contentType": "form-urlencoded",
        "bodyParameters": {
          "parameters": [
            {
              "name": "chat_id",
              "value": "TELEGRAM_CHAT_ID_HERE"
            },
            {
              "name": "text",
              "value": "={{$json.long_story_text}}"
            }
          ]
        },
        "options": {}
      },
      "id": "18",
      "name": "Publish Telegram Text",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1540,
        340
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "tk1",
              "name": "tiktok_title",
              "value": "={{$json.title}}",
              "type": "string"
            },
            {
              "id": "tk2",
              "name": "tiktok_description",
              "value": "={{$json.description}}",
              "type": "string"
            },
            {
              "id": "tk3",
              "name": "tiktok_hashtags",
              "value": "=#delovoizanos #shorts #stream #fyp",
              "type": "string"
            },
            {
              "id": "tk4",
              "name": "tiktok_video_url",
              "value": "={{$json.video_url}}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "19",
      "name": "Prepare TikTok Metadata",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1540,
        180
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={\n  \"status\": \"accepted\",\n  \"content_type\": {{$json.content_type || 'scheduled'}},\n  \"message\": \"Workflow started\"\n}",
        "options": {}
      },
      "id": "20",
      "name": "Webhook Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        -1060,
        360
      ]
    }
  ],
  "connections": {
    "Cron Trigger": {
      "main": [
        [
          {
            "node": "Normalize Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "Normalize Input",
            "type": "main",
            "index": 0
          },
          {
            "node": "Webhook Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Input": {
      "main": [
        [
          {
            "node": "Choose Branch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Choose Branch": {
      "main": [
        [
          {
            "node": "Warmup Script",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Gambling Script",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Warmup Script",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Warmup Script": {
      "main": [
        [
          {
            "node": "TTS ElevenLabs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gambling Script": {
      "main": [
        [
          {
            "node": "TTS ElevenLabs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "TTS ElevenLabs": {
      "main": [
        [
          {
            "node": "Prepare Audio URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Audio URL": {
      "main": [
        [
          {
            "node": "Create HeyGen Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create HeyGen Video": {
      "main": [
        [
          {
            "node": "Wait Before Status Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait Before Status Check": {
      "main": [
        [
          {
            "node": "Check HeyGen Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check HeyGen Status": {
      "main": [
        [
          {
            "node": "Video Ready?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Video Ready?": {
      "main": [
        [
          {
            "node": "Extract Video URL",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait Before Status Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Video URL": {
      "main": [
        [
          {
            "node": "Publish YouTube",
            "type": "main",
            "index": 0
          },
          {
            "node": "Publish Telegram Video",
            "type": "main",
            "index": 0
          },
          {
            "node": "Is Gambling Branch?",
            "type": "main",
            "index": 0
          },
          {
            "node": "Prepare TikTok Metadata",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Gambling Branch?": {
      "main": [
        [
          {
            "node": "Publish Telegram Text",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1",
  "id": "DeloVoiZanosContentFactory",
  "tags": []
}