{
  "name": "Vorlux AI | Captions & Translation",
  "nodes": [
    {
      "id": "daacc745-9b7a-476a-aa0e-365328613725",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        220,
        300
      ],
      "webhookId": "e0f64da3-266d-4288-b2aa-97a34d887954",
      "parameters": {
        "httpMethod": "POST",
        "path": "captions-translate",
        "options": {
          "responseMode": "lastNode"
        }
      }
    },
    {
      "id": "21fe1e3b-92a6-4157-b82e-c0b4c4304ec6",
      "name": "Process",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        460,
        300
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "const d=$input.first().json.body||$input.first().json;\nreturn [{json:{videoId:d.videoId||'',title:d.title||'',sourceLang:d.language||'en',targetLangs:d.targetLanguages||['es','pt','fr']}}];"
      }
    },
    {
      "id": "e2c78e5e-a281-4e33-8200-3d61cee747f7",
      "name": "Get Transcript",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        700,
        200
      ],
      "parameters": {
        "method": "GET",
        "url": "={{$env.VORLUX_HUB_URL}}/api/broadcast/sessions/{{ $json.videoId }}/transcript",
        "options": {
          "timeout": 15000
        }
      }
    },
    {
      "id": "e465e863-6c81-4c66-8bd1-eae1dce76213",
      "name": "AI Translate",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        700,
        400
      ],
      "parameters": {
        "method": "POST",
        "url": "={{$env.VORLUX_HUB_URL}}/api/orchestrator/execute",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\"agentId\":\"content-writer\",\"action\":\"translate\",\"params\":{\"targetLangs\":{{ JSON.stringify($json.targetLangs) }}}}",
        "options": {
          "timeout": 60000
        }
      }
    },
    {
      "id": "50c1730d-978b-4bcb-8d83-b9e3ad90a180",
      "name": "Respond",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        940,
        300
      ],
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({ok:true}) }}"
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Process",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process": {
      "main": [
        [
          {
            "node": "Get Transcript",
            "type": "main",
            "index": 0
          },
          {
            "node": "AI Translate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Transcript": {
      "main": [
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Translate": {
      "main": [
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "saveManualExecutions": true,
    "saveExecutionProgress": true
  }
}