{
  "name": "Turn daily trends into Videotok faceless Shorts",
  "nodes": [
    {
      "parameters": {
        "content": "## Videotok daily trend to faceless Short\n\nFor social teams that need one fresh TikTok, Reel, or Short every day.\n\nSetup:\n1. Add VIDEOTOK_API_KEY and OPENAI_API_KEY as n8n variables.\n2. Replace the Research Trends URL with your niche source.\n3. Run once manually, check credits, then activate the schedule.\n\nVideotok API used: GET /assets, POST /faceless-videos, GET /videos/{id}.",
        "height": 300,
        "width": 460,
        "color": 4
      },
      "id": "note-overview",
      "name": "Overview and setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [-660, -260]
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 8 * * *"
            }
          ]
        }
      },
      "id": "schedule",
      "name": "Run every morning",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [-620, 120]
    },
    {
      "parameters": {
        "url": "https://news.google.com/rss/search?q={{$vars.TREND_QUERY || 'social media marketing trends'}}&hl=en-US&gl=US&ceid=US:en",
        "options": {
          "response": {
            "response": {
              "responseFormat": "text"
            }
          }
        }
      },
      "id": "research",
      "name": "Research online trends",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [-360, 120]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.openai.com/v1/responses",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{$vars.OPENAI_API_KEY}}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\"model\":\"gpt-4.1-mini\",\"input\":\"You are a social strategist. From this research feed, pick one timely short-form video idea for our brand. Return strict JSON with title, hook, script, visual_prompt, caption, hashtags. Feed: \" + JSON.stringify($json).slice(0, 12000)}"
      },
      "id": "openai-brief",
      "name": "OpenAI selects angle and script",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [-80, 120]
    },
    {
      "parameters": {
        "jsCode": "const raw = $input.first().json.output_text || $input.first().json.output?.[0]?.content?.[0]?.text || '{}';\nlet brief;\ntry { brief = JSON.parse(raw); } catch (error) { brief = { title: 'Daily trend short', hook: raw.slice(0, 160), script: raw, visual_prompt: raw, caption: raw.slice(0, 220), hashtags: '#videotok #ai #socialmedia' }; }\nreturn [{ json: { ...brief, idempotency_key: `trend-short-${$execution.id}` } }];"
      },
      "id": "prepare",
      "name": "Prepare Videotok payload",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [200, 120]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://videotok.app/api/v1/faceless-videos",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{$vars.VIDEOTOK_API_KEY}}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Idempotency-Key",
              "value": "={{$json.idempotency_key}}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\"title\":$json.title,\"prompt\":$json.visual_prompt,\"script\":$json.script,\"aspect_ratio\":\"9:16\",\"duration\":\"26\",\"language\":\"en\",\"voice_id\":$vars.VIDEOTOK_VOICE_ID || \"ash\",\"brand_kit_id\":$vars.VIDEOTOK_BRAND_KIT_ID}"
      },
      "id": "create-video",
      "name": "Create Videotok faceless video",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [500, 120]
    },
    {
      "parameters": {
        "amount": 90,
        "unit": "seconds"
      },
      "id": "wait",
      "name": "Wait before polling",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [760, 120]
    },
    {
      "parameters": {
        "url": "=https://videotok.app/api/v1/videos/{{$json.video_id}}",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{$vars.VIDEOTOK_API_KEY}}"
            }
          ]
        }
      },
      "id": "poll-video",
      "name": "Poll Videotok video status",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [1020, 120]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "title",
              "name": "review_title",
              "type": "string",
              "value": "={{$json.title || 'Daily Videotok short'}}"
            },
            {
              "id": "url",
              "name": "videotok_url",
              "type": "string",
              "value": "={{$json.url}}"
            },
            {
              "id": "status",
              "name": "status",
              "type": "string",
              "value": "={{$json.status}}"
            }
          ]
        }
      },
      "id": "handoff",
      "name": "Send to review queue",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [1280, 120]
    }
  ],
  "connections": {
    "Run every morning": {
      "main": [
        [
          {
            "node": "Research online trends",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Research online trends": {
      "main": [
        [
          {
            "node": "OpenAI selects angle and script",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI selects angle and script": {
      "main": [
        [
          {
            "node": "Prepare Videotok payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Videotok payload": {
      "main": [
        [
          {
            "node": "Create Videotok faceless video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Videotok faceless video": {
      "main": [
        [
          {
            "node": "Wait before polling",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait before polling": {
      "main": [
        [
          {
            "node": "Poll Videotok video status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Poll Videotok video status": {
      "main": [
        [
          {
            "node": "Send to review queue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "tags": ["videotok", "openai", "social media", "faceless video"],
  "active": false,
  "versionId": "videotok-daily-trend-faceless-shorts-1"
}
