{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "TikTok Videos That Resonate With Your Target Audience",
  "tags": [
    {
      "name": "Content Creation"
    },
    {
      "name": "AI"
    },
    {
      "name": "TikTok"
    },
    {
      "name": "Marketing"
    }
  ],
  "nodes": [
    {
      "id": "sticky-main-overview",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "color": 4,
        "width": 380,
        "height": 904,
        "content": "## TikTok Videos That Resonate With Your Target Audience\nCreate TikTok videos grounded in real human insight using AI and Digital Twins.\n\n### How it works\n1. **Telegram** triggers the workflow (send your product/concept)\n2. **AI Agent** researches trends, gathers audience feedback, writes scripts informed by real insights, and tests them with Digital Twins\n3. **Veo 3** generates video from the most resonant script\n4. **Telegram** sends the video back to you\n\n### Setup\n1. Edit **Workflow Configuration** with:\n   - Product details (name, description, audience, tone)\n2. Connect **Telegram Bot** credentials (@BotFather)\n3. Connect **OpenAI API** credentials on Chat Model node\n4. Connect **Header Auth** on Apify MCP node:\n   - Header: `Authorization`\n   - Value: `Bearer YOUR_APIFY_TOKEN`\n5. Connect **Header Auth** on OriginalVoices node:\n   - Header: `X-Api-Key`\n   - Value: `YOUR_API_KEY`\n6. Connect **Header Auth** on Veo 3 & Poll nodes:\n   - Header: `Authorization`\n   - Value: `Key YOUR_FAL_API_KEY`\n7. **Activate** the workflow\n\n### Customize\n- **Audience**: Refine targetAudience for specific demographics\n- **Trends**: Modify agent prompt for different niches\n- **Scripts**: Adjust number of variations\n- **Video style**: Update Veo 3 prompt\n\n### Need help?\nReach out on Discord (`vedad27`) or email `vedad@originalvoices.ai`"
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-config",
      "name": "Sticky Note Config",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        432,
        112
      ],
      "parameters": {
        "color": 7,
        "width": 228,
        "height": 288,
        "content": "### 1. Trigger"
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-trigger",
      "name": "Sticky Note Trigger",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        704,
        112
      ],
      "parameters": {
        "color": 7,
        "height": 288,
        "content": "### 2. Configuration\nEdit with your product details"
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-agent",
      "name": "Sticky Note Agent",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        960,
        112
      ],
      "parameters": {
        "color": 7,
        "width": 496,
        "height": 484,
        "content": "### 3. Research, Write & Test\nConnect Apify + OriginalVoices credentials"
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-video",
      "name": "Sticky Note Video",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1504,
        112
      ],
      "parameters": {
        "color": 7,
        "width": 420,
        "height": 480,
        "content": "### 4. Generate Video"
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-report",
      "name": "Sticky Note Report",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1984,
        112
      ],
      "parameters": {
        "color": 7,
        "width": 420,
        "height": 480,
        "content": "### 5. Report back to Telegram"
      },
      "typeVersion": 1
    },
    {
      "id": "config-node",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        784,
        208
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "product-name",
              "name": "productName",
              "type": "string",
              "value": "Your Product Name"
            },
            {
              "id": "product-description",
              "name": "productDescription",
              "type": "string",
              "value": "A brief description of what your product does and the problem it solves"
            },
            {
              "id": "target-audience",
              "name": "targetAudience",
              "type": "string",
              "value": "US, 18-35, interested in tech and productivity"
            },
            {
              "id": "tone",
              "name": "tone",
              "type": "string",
              "value": "casual, energetic, Gen-Z friendly"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "telegram-trigger",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        496,
        208
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "creative-agent",
      "name": "Research, Write & Test",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        992,
        208
      ],
      "parameters": {
        "text": "=You are a TikTok content strategist who creates viral videos. You have access to two tools:\n\n1. **Apify** - Use this to scrape TikTok for current trending content\n2. **ask_twins** - Use this to get real human feedback (Digital Twins)\n\n---\n\nVIDEO TOPIC/DIRECTION (from user):\n{{ $('Telegram Trigger').item.json.message.text }}\n\nPRODUCT INFO:\n- Name: {{ $('Workflow Configuration').item.json.productName }}\n- Description: {{ $('Workflow Configuration').item.json.productDescription }}\n- Target Audience: {{ $('Workflow Configuration').item.json.targetAudience }}\n- Desired Tone: {{ $('Workflow Configuration').item.json.tone }}\n\n---\n\nYOUR TASK - Complete these 3 steps:\n\n## STEP 1: Research Trends & Product Perception\nDo both in parallel:\n\n**Trends**: Use Apify to find 5-10 trending TikTok videos. Look for:\n- Viral formats and hooks\n- Popular sounds/music\n- Trending hashtags\n- Content styles that are working right now\n\n**Product Perception**: Use ask_twins to understand how the target audience perceives the product. Include the product name and description in your question. Ask:\n- What problem do they think this solves?\n- What would make them interested?\n- What concerns or objections might they have?\n\n## STEP 2: Write Scripts\nBased on BOTH the twin insights about product perception AND the trends you found, create 3 different TikTok video scripts (15-30 seconds each) that:\n- Address the interests and objections raised by Digital Twins\n- Incorporate trending elements (formats, hooks, styles)\n- Naturally showcase the product\n- Have viral potential\n\nFor each script, define:\n- HOOK (first 2-3 seconds to stop scrolling)\n- SCRIPT (full voiceover/dialogue)\n- VISUAL DIRECTION (what should be shown on screen)\n\n## STEP 3: Test Scripts with Digital Twins\nUse ask_twins to test your scripts with the target audience.\n\nCRITICAL for ask_twins:\n- It only accepts: audience (demographic string) and questions (array of strings)\n- Digital Twins CANNOT see your scripts - you MUST include the full script content INSIDE each question\n- Make 2 calls:\n  1. Hook test: Embed all 3 hooks, ask which would make them stop scrolling\n  2. Authenticity test: Embed full scripts, ask which feels least like an ad\n\n---\n\nOUTPUT FORMAT:\nAfter completing all 3 steps, respond with ONLY raw JSON. No markdown, no code blocks, no explanation - just the JSON object.\n\nIMPORTANT FOR videoPrompt: Write an ACTUAL detailed video generation prompt (100-150 words), NOT placeholders. Example of a GOOD videoPrompt:\n\"Scene 1 (0-3s): Extreme close-up of fingers tapping a phone screen, soft morning window light from the left, shallow depth of field, quiz app interface glowing. Scene 2 (3-6s): Medium shot of a young woman's face, eyes widening with excitement, natural bedroom lighting, subtle smile forming. Scene 3 (6-8s): Pull back to show her jumping up celebrating, confetti overlay, warm golden hour tones. Style: photorealistic, shot on iPhone 15 Pro, authentic UGC aesthetic, smooth transitions. Color grading: warm and vibrant.\"\n\nJSON structure:\n\n{\n  \"trends\": [\"brief summary of trends found\"],\n  \"productInsights\": {\n    \"appeal\": \"What twins found interesting about the product\",\n    \"concerns\": \"Objections or hesitations they mentioned\"\n  },\n  \"scripts\": [\n    {\n      \"id\": 1,\n      \"hook\": \"...\",\n      \"script\": \"...\",\n      \"visualDirection\": \"...\"\n    }\n  ],\n  \"scriptTestFeedback\": {\n    \"hookWinner\": \"Which hook won and why\",\n    \"authenticityWinner\": \"Which script felt most authentic\",\n    \"concerns\": \"Any concerns raised\"\n  },\n  \"bestScript\": {\n    \"id\": 1,\n    \"hook\": \"...\",\n    \"script\": \"...\",\n    \"visualDirection\": \"...\"\n  },\n  \"videoPrompt\": \"Scene 1 (0-3s): [WRITE detailed shot - camera angle, lighting, subject, action]. Scene 2 (3-6s): [WRITE next shot with same detail]. Scene 3 (6-8s): [WRITE final shot]. Style: photorealistic, iPhone 15 Pro footage, natural lighting, shallow DOF, 4K. Color: [warm/cool/vibrant]. THIS MUST BE 100-150 WORDS OF ACTUAL SCENE DESCRIPTIONS, NOT PLACEHOLDERS.\",\n  \"reasoning\": \"Why this script won based on Digital Twin feedback\",\n  \"caption\": \"Catchy TikTok caption under 150 characters that drives engagement\",\n  \"hashtags\": [\"trending1\", \"niche1\", \"product1\", \"viral\", \"fyp\"]\n}\n\nCRITICAL: Output ONLY the JSON object. Do not wrap in ```json``` code blocks. Do not add any text before or after the JSON.",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 3.1
    },
    {
      "id": "openai-model",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        992,
        432
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "typeVersion": 1.3
    },
    {
      "id": "apify-mcp-tool",
      "name": "Apify MCP",
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "position": [
        1136,
        432
      ],
      "parameters": {
        "options": {},
        "endpointUrl": "https://mcp.apify.com/sse",
        "authentication": "headerAuth",
        "serverTransport": "sse"
      },
      "typeVersion": 1.2
    },
    {
      "id": "ov-mcp-tool",
      "name": "OriginalVoices Digital Twins",
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "position": [
        1264,
        432
      ],
      "parameters": {
        "options": {},
        "endpointUrl": "https://api.originalvoices.ai/mcp",
        "authentication": "headerAuth"
      },
      "typeVersion": 1.2
    },
    {
      "id": "parse-json",
      "name": "Parse JSON",
      "type": "n8n-nodes-base.code",
      "position": [
        1280,
        208
      ],
      "parameters": {
        "jsCode": "const output = $input.first().json.output;\n// Strip markdown code blocks if present\nlet jsonStr = output;\nif (typeof output === 'string') {\n  jsonStr = output.replace(/```json\\n?/g, '').replace(/```\\n?/g, '').trim();\n}\nconst parsed = typeof jsonStr === 'string' ? JSON.parse(jsonStr) : jsonStr;\nreturn [{ json: parsed }];"
      },
      "typeVersion": 2
    },
    {
      "id": "generate-video-veo3",
      "name": "Generate Video (Veo 3)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1664,
        208
      ],
      "parameters": {
        "url": "https://queue.fal.run/fal-ai/veo3.1",
        "method": "POST",
        "options": {
          "response": {
            "response": {
              "responseFormat": "json"
            }
          }
        },
        "jsonBody": "={\n  \"prompt\": \"{{ $json.videoPrompt }}\",\n  \"aspect_ratio\": \"9:16\",\n  \"duration\": \"8s\"\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "poll-video-status",
      "name": "Poll Video Status",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1760,
        432
      ],
      "parameters": {
        "url": "=https://queue.fal.run/fal-ai/veo3.1/requests/{{ $json.request_id }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "json"
            }
          }
        },
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "telegram-confirm",
      "name": "Confirm via Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2144,
        272
      ],
      "parameters": {
        "text": "=Video ready!\n\nHook:\n{{ $('Parse JSON').item.json.bestScript.hook }}\n\nCaption:\n{{ $('Parse JSON').item.json.caption }} {{ $('Parse JSON').item.json.hashtags.map(h => '#' + h).join(' ') }}\n\nVideo URL:\n{{ $json.video?.url || $json.output?.video?.url || 'Video generation in progress' }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "wait-for-video",
      "name": "Wait for Video",
      "type": "n8n-nodes-base.wait",
      "position": [
        1568,
        432
      ],
      "parameters": {
        "amount": 60
      },
      "typeVersion": 1.1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "Apify MCP": {
      "ai_tool": [
        [
          {
            "node": "Research, Write & Test",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Parse JSON": {
      "main": [
        [
          {
            "node": "Generate Video (Veo 3)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Video": {
      "main": [
        [
          {
            "node": "Poll Video Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Research, Write & Test",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Poll Video Status": {
      "main": [
        [
          {
            "node": "Confirm via Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Video (Veo 3)": {
      "main": [
        [
          {
            "node": "Wait for Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Research, Write & Test": {
      "main": [
        [
          {
            "node": "Parse JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Research, Write & Test",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OriginalVoices Digital Twins": {
      "ai_tool": [
        [
          {
            "node": "Research, Write & Test",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}