{
  "name": "TikTok Automation - Gera\u00e7\u00e3o Di\u00e1ria",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 24
            }
          ]
        }
      },
      "id": "trigger-diario",
      "name": "Trigger Di\u00e1rio",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        300
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "http://tiktok-automation:8000/api/generate-daily",
        "options": {
          "timeout": 300000
        }
      },
      "id": "chamar-api-geracao",
      "name": "Chamar API Gera\u00e7\u00e3o",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        220,
        300
      ],
      "notes": "Chama o endpoint de gera\u00e7\u00e3o di\u00e1ria do servi\u00e7o de automa\u00e7\u00e3o"
    },
    {
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value": "={{ $json.sucesso === true }}"
            }
          ]
        }
      },
      "id": "verificar-sucesso",
      "name": "Verificar Sucesso",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        440,
        300
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.telegram.org/bot{{ $credentials.telegram.token }}/sendMessage",
        "options": {
          "body": {
            "chat_id": "={{ $json.chatId }}",
            "text": "\u2705 *Conte\u00fado TikTok Gerado!*\n\n\ud83d\udcf0 *Not\u00edcia:* {{ $json.noticia.titulo }}\n\n\ud83c\udfac *V\u00eddeo:* {{ $json.video }}\n\n\u23f1\ufe0f *Dura\u00e7\u00e3o:* {{ $json.duracao }}s\n\n\ud83d\udd50 {{ $json.timestamp }}",
            "parse_mode": "Markdown"
          }
        }
      },
      "id": "notificar-sucesso",
      "name": "Notificar Sucesso",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        660,
        200
      ],
      "notes": "Envia notifica\u00e7\u00e3o de sucesso no Telegram"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.telegram.org/bot{{ $credentials.telegram.token }}/sendMessage",
        "options": {
          "body": {
            "chat_id": "={{ $json.chatId }}",
            "text": "\u274c *Erro na Gera\u00e7\u00e3o TikTok*\n\n\ud83d\udcdd *Erro:* {{ $json.erro }}\n\n\ud83d\udd50 {{ $json.timestamp }}",
            "parse_mode": "Markdown"
          }
        }
      },
      "id": "notificar-erro",
      "name": "Notificar Erro",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        660,
        400
      ],
      "notes": "Envia notifica\u00e7\u00e3o de erro no Telegram"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "http://tiktok-automation:8000/api/upload-pending",
        "options": {}
      },
      "id": "upload-pendente",
      "name": "Upload Pendente",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        880,
        200
      ],
      "notes": "Faz upload do v\u00eddeo gerado (se configurado)"
    }
  ],
  "connections": {
    "Trigger Di\u00e1rio": {
      "main": [
        [
          {
            "node": "Chamar API Gera\u00e7\u00e3o",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Chamar API Gera\u00e7\u00e3o": {
      "main": [
        [
          {
            "node": "Verificar Sucesso",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Verificar Sucesso": {
      "main": [
        [
          {
            "node": "Notificar Sucesso",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Notificar Erro",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notificar Sucesso": {
      "main": [
        [
          {
            "node": "Upload Pendente",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "tiktok-auto-daily-v1",
  "meta": {
    "templateVersion": "1.0",
    "description": "Workflow di\u00e1rio para gera\u00e7\u00e3o autom\u00e1tica de conte\u00fado TikTok",
    "tags": [
      "tiktok",
      "automacao",
      "diario",
      "ia"
    ]
  },
  "id": "tiktok_automation_daily",
  "tags": []
}