{
  "name": "Turn daily trends into Videotok faceless Shorts",
  "nodes": [
    {
      "parameters": {
        "content": "## Turn daily trends into Videotok faceless Shorts\n\n### How it works\n\n1. Triggers at 9am every morning to start the process.\n2. Fetches the latest Google News trends.\n3. Sends the news trends to OpenAI for script generation.\n4. Prepares and sends a payload to Videotok for video creation.\n5. Waits, then checks the status of the video creation and sets review data.\n\n### Setup steps\n\n- [ ] Configure the schedule trigger for the desired time.\n- [ ] Set up HTTP credentials for accessing Google News API.\n- [ ] Enter API Key for OpenAI script generation.\n- [ ] Provide HTTP Request setup for Videotok API.\n\n### Customization\n\nAdjust the waiting time as needed before checking video status.",
        "width": 480,
        "height": 640
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [-1232, 0],
      "id": "5f497ca6-c768-4766-997e-a6e67710f5e7",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "## Fetch trends and generate script\n\nFetches Google News trends and then generates a script using OpenAI. Activates workflow every morning at 9am.",
        "width": 736,
        "height": 304,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [-672, 0],
      "id": "d6165402-8616-4800-9015-f494b231c836",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "content": "## Prepare and post to Videotok\n\nBuilds payload for Videotok and initiates faceless video creation.",
        "width": 480,
        "height": 304,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [160, 0],
      "id": "183e2e46-9ef9-4746-a878-9b9768c4348f",
      "name": "Sticky Note2"
    },
    {
      "parameters": {
        "content": "## Wait and poll video status\n\nWaits before fetching the video status from Videotok API.",
        "width": 704,
        "height": 272,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [720, 16],
      "id": "81cc2563-995a-42bd-85bd-30be906139dc",
      "name": "Sticky Note3"
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 8 * * *"
            }
          ]
        }
      },
      "id": "schedule",
      "name": "Daily Morning Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [-624, 128]
    },
    {
      "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": "Fetch News Trends RSS",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [-352, 128]
    },
    {
      "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": "Generate Script via OpenAI API",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [-80, 128]
    },
    {
      "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 Request",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [208, 128]
    },
    {
      "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": "Send to Videotok API",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [496, 128]
    },
    {
      "parameters": {
        "amount": 90,
        "unit": "seconds"
      },
      "id": "wait",
      "name": "Wait for Videotok Processing",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [768, 128]
    },
    {
      "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": "Check Videotok Video Status",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [1024, 128]
    },
    {
      "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": "Set Review Data for Queue",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [1280, 128]
    }
  ],
  "connections": {
    "Daily Morning Trigger": {
      "main": [
        [
          {
            "node": "Fetch News Trends RSS",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch News Trends RSS": {
      "main": [
        [
          {
            "node": "Generate Script via OpenAI API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Script via OpenAI API": {
      "main": [
        [
          {
            "node": "Prepare Videotok Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Videotok Request": {
      "main": [
        [
          {
            "node": "Send to Videotok API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send to Videotok API": {
      "main": [
        [
          {
            "node": "Wait for Videotok Processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Videotok Processing": {
      "main": [
        [
          {
            "node": "Check Videotok Video Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Videotok Video Status": {
      "main": [
        [
          {
            "node": "Set Review Data for 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"
}
