{
  "name": "Generador y Publicador de Shorts",
  "nodes": [
    {
      "parameters": {
        "interval": 2,
        "unit": "hours"
      },
      "name": "Cada 2 Horas",
      "type": "n8n-nodes-base.cron",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "operation": "lookup",
        "sheetId": "tu_id_de_hoja",
        "range": "Ideas!A:G",
        "lookupColumn": "production",
        "lookupValue": "pendiente"
      },
      "name": "Leer Idea de Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 2,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "prompt": "Escribe un guion de video viral tipo POV basado en esta idea: {{$json[\"idea\"]}}",
        "model": "gpt-4",
        "temperature": 0.7
      },
      "name": "Generar Guion",
      "type": "n8n-nodes-base.openai",
      "typeVersion": 1,
      "position": [
        650,
        300
      ]
    },
    {
      "parameters": {
        "text": "{{$node[\"Generar Guion\"].json[\"text\"]}}",
        "voice": "Rachel"
      },
      "name": "Generar Voz con ElevenLabs",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        850,
        300
      ]
    },
    {
      "parameters": {
        "prompt": "Escena para: {{$json[\"environment_prompt\"]}}",
        "width": 720,
        "height": 1280
      },
      "name": "Imagen con Leonardo AI",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        850,
        500
      ]
    },
    {
      "parameters": {
        "template": "POV Template",
        "audioUrl": "{{$node[\"Generar Voz con ElevenLabs\"].json[\"url\"]}}",
        "imageUrl": "{{$node[\"Imagen con Leonardo AI\"].json[\"url\"]}}",
        "text": "{{$node[\"Generar Guion\"].json[\"text\"]}}"
      },
      "name": "Crear Video con Creatomate",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        1050,
        300
      ]
    },
    {
      "parameters": {
        "title": "{{$json[\"caption\"]}}",
        "videoUrl": "{{$node[\"Crear Video con Creatomate\"].json[\"video_url\"]}}",
        "visibility": "public"
      },
      "name": "Publicar en YouTube Shorts",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        1250,
        300
      ]
    },
    {
      "parameters": {
        "sheetId": "tu_id_de_hoja",
        "range": "Ideas!A:G",
        "updateData": [
          {
            "key": "id",
            "value": "{{$json[\"id\"]}}"
          },
          {
            "key": "production",
            "value": "completado"
          },
          {
            "key": "publishing",
            "value": "publicado"
          },
          {
            "key": "final_output",
            "value": "{{$node[\"Publicar en YouTube Shorts\"].json[\"videoUrl\"]}}"
          }
        ]
      },
      "name": "Actualizar Estado en Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 2,
      "position": [
        1450,
        300
      ]
    }
  ],
  "connections": {
    "Cada 2 Horas": {
      "main": [
        [
          {
            "node": "Leer Idea de Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Leer Idea de Sheets": {
      "main": [
        [
          {
            "node": "Generar Guion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generar Guion": {
      "main": [
        [
          {
            "node": "Generar Voz con ElevenLabs",
            "type": "main",
            "index": 0
          },
          {
            "node": "Imagen con Leonardo AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generar Voz con ElevenLabs": {
      "main": [
        [
          {
            "node": "Crear Video con Creatomate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Imagen con Leonardo AI": {
      "main": [
        [
          {
            "node": "Crear Video con Creatomate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Crear Video con Creatomate": {
      "main": [
        [
          {
            "node": "Publicar en YouTube Shorts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Publicar en YouTube Shorts": {
      "main": [
        [
          {
            "node": "Actualizar Estado en Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}