{
  "name": "Ramadhan Shorts FULL Automation (YT + TikTok + Reels)",
  "nodes": [
    {
      "id": 1,
      "name": "Cron Sahur",
      "type": "n8n-nodes-base.cron",
      "position": [
        100,
        300
      ],
      "parameters": {
        "schedule": {
          "hour": [
            4
          ],
          "minute": [
            30
          ]
        }
      }
    },
    {
      "id": 2,
      "name": "Google Sheets - Topik",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        300,
        300
      ],
      "parameters": {
        "operation": "read",
        "sheetId": "GANTI_DENGAN_SHEET_ID",
        "range": "B2:B32"
      }
    },
    {
      "id": 3,
      "name": "Set Topic",
      "type": "n8n-nodes-base.set",
      "position": [
        500,
        300
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "topic",
              "value": "={{$json[\"Topik\"]}}"
            }
          ]
        }
      }
    },
    {
      "id": 4,
      "name": "OpenAI Script (Anti Demon)",
      "type": "n8n-nodes-base.openAi",
      "position": [
        700,
        300
      ],
      "parameters": {
        "operation": "chat",
        "model": "gpt-4o-mini",
        "messages": [
          {
            "role": "system",
            "content": "Kamu adalah AI ustadz Ramadhan. Bahasa lembut, menenangkan, tidak menghakimi, aman monetisasi."
          },
          {
            "role": "user",
            "content": "Buat script Shorts Ramadhan 40 detik tentang: {{$json.topic}}.\nStruktur: Hook 2 detik \u2192 Renungan \u2192 Nasihat \u2192 Doa.\nTanpa ancaman, tanpa kata kasar."
          }
        ]
      }
    },
    {
      "id": 5,
      "name": "OpenAI Title + Hashtag",
      "type": "n8n-nodes-base.openAi",
      "position": [
        900,
        300
      ],
      "parameters": {
        "operation": "chat",
        "model": "gpt-4o-mini",
        "messages": [
          {
            "role": "user",
            "content": "Buat 1 judul Shorts Ramadhan (\u226470 karakter) dan 5 hashtag dari script ini:\n{{$json.choices[0].message.content}}"
          }
        ]
      }
    },
    {
      "id": 6,
      "name": "TTS Ustadz Voice",
      "type": "n8n-nodes-base.openAi",
      "position": [
        1100,
        300
      ],
      "parameters": {
        "operation": "textToSpeech",
        "model": "gpt-4o-mini-tts",
        "voice": "verse",
        "input": "={{$node['OpenAI Script (Anti Demon)'].json.choices[0].message.content}}"
      }
    },
    {
      "id": 7,
      "name": "FFmpeg Video",
      "type": "n8n-nodes-base.executeCommand",
      "position": [
        1300,
        300
      ],
      "parameters": {
        "command": "ffmpeg -loop 1 -i mosque.jpg -i voice.mp3 -vf \"scale=1080:1920,subtitles=sub.srt\" -t 45 -pix_fmt yuv420p output.mp4"
      }
    },
    {
      "id": 8,
      "name": "Upload YouTube Shorts",
      "type": "n8n-nodes-base.youtube",
      "position": [
        1500,
        200
      ],
      "parameters": {
        "operation": "upload",
        "title": "={{$node['OpenAI Title + Hashtag'].json.choices[0].message.content}}",
        "videoFile": "output.mp4",
        "description": "Renungan Ramadhan \ud83c\udf19",
        "additionalFields": {
          "privacyStatus": "public"
        }
      }
    },
    {
      "id": 9,
      "name": "Upload TikTok",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1500,
        300
      ],
      "parameters": {
        "url": "https://open.tiktokapis.com/v2/post/publish/",
        "method": "POST",
        "headers": {
          "Authorization": "Bearer TIKTOK_TOKEN"
        },
        "body": {
          "video": "output.mp4",
          "caption": "={{$node['OpenAI Title + Hashtag'].json.choices[0].message.content}} #ramadhan #islam"
        }
      }
    },
    {
      "id": 10,
      "name": "Upload Instagram Reels",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1500,
        400
      ],
      "parameters": {
        "url": "https://graph.facebook.com/v19.0/IG_USER_ID/media",
        "method": "POST",
        "body": {
          "video_url": "output.mp4",
          "caption": "={{$node['OpenAI Title + Hashtag'].json.choices[0].message.content}} \ud83c\udf19",
          "media_type": "REELS"
        }
      }
    }
  ],
  "connections": {
    "Cron Sahur": {
      "main": [
        [
          {
            "node": "Google Sheets - Topik",
            "type": "main"
          }
        ]
      ]
    },
    "Google Sheets - Topik": {
      "main": [
        [
          {
            "node": "Set Topic",
            "type": "main"
          }
        ]
      ]
    },
    "Set Topic": {
      "main": [
        [
          {
            "node": "OpenAI Script (Anti Demon)",
            "type": "main"
          }
        ]
      ]
    },
    "OpenAI Script (Anti Demon)": {
      "main": [
        [
          {
            "node": "OpenAI Title + Hashtag",
            "type": "main"
          }
        ]
      ]
    },
    "OpenAI Title + Hashtag": {
      "main": [
        [
          {
            "node": "TTS Ustadz Voice",
            "type": "main"
          }
        ]
      ]
    },
    "TTS Ustadz Voice": {
      "main": [
        [
          {
            "node": "FFmpeg Video",
            "type": "main"
          }
        ]
      ]
    },
    "FFmpeg Video": {
      "main": [
        [
          {
            "node": "Upload YouTube Shorts",
            "type": "main"
          }
        ],
        [
          {
            "node": "Upload TikTok",
            "type": "main"
          }
        ],
        [
          {
            "node": "Upload Instagram Reels",
            "type": "main"
          }
        ]
      ]
    }
  }
}