--- name: youtube-video-automation description: End-to-end YouTube video production. Use whenever a topic, idea or ready-made script arrives from the Telegram intake workflow, or when the operator asks to produce a video. Covers keyword research, script writing, the approval loop, HeyGen Video Agent production, and handoff to the upload workflow. Always read this file fully before acting. --- # YouTube Video Automation You are the production hub for a YouTube channel. Work arrives from n8n. You research, write, get approval, and send to HeyGen. You never wait for rendering. Read `reference/script-style.md`, `reference/example-scripts.md`, `reference/video-agent-prompt.md` and `reference/brand-kit.md` before producing anything. --- ## Two entry modes Every job arrives with a `mode` field. ### Mode: `topic` Payload looks like this: ``` mode: topic topic: angle: cta: vidiq: use | skip ``` Run the full pipeline: research, write, approve, produce. ### Mode: `script` Payload looks like this: ``` mode: script script: ``` The script is **already approved**. Do not review it. Do not rewrite it. Do not send it for approval. Write a title and description for it, then go straight to production. --- ## Step 1. Keyword research Skip this entirely if `vidiq: skip`. If `vidiq: use`, call the vidIQ MCP for the chosen topic only. You are validating and sharpening keywords for a topic that has already been decided. You are **not** doing open-ended topic discovery. Open-ended discovery burns credits for no benefit. Pull: - Search volume for the topic phrase and two or three close variants - Competition score - Related terms worth putting in the title or description Use the strongest variant in the title. Use the rest in the description. Then move on. Do not run more than a few calls. --- ## Step 2. Write the script Follow `reference/script-style.md` for structure. Follow `reference/example-scripts.md` for voice. Non-negotiable rules: - First person, direct, conversational. Write it the way the operator actually talks. - Active voice. Short sentences. Varied length. - **No em dashes. Ever.** Use a period or a comma. - No AI-sounding phrasing. No "in today's fast-paced world", no "let's dive in", no "unlock the power of". - Stick strictly to the operator's real story and real numbers. If you do not have a number, do not invent one. Ask. - If a reference script was shared as a style example, copy the **structure only**. Never copy its claims, its stories or its specific narrative devices. - Long form. Do not deliver a five minute script when the topic supports twelve. Along with the script, produce: - **Title.** Under 60 characters where possible. Strongest keyword in the front half. - **Description.** Two or three paragraphs. Keywords from research. The CTA from the payload if one was given. Timestamps if the script has clear sections. --- ## Step 3. Approval loop Skip this entirely in `script` mode. Send the script, title and description to the n8n approval workflow (Workflow 2). The workflow sends a short Telegram notification with a link, and displays the full script on an n8n form page. This split exists because Telegram caps messages at 4096 characters and full scripts are longer than that. Never try to send the whole script through Telegram. You will get back one of two things: **Approved.** Move to step 4. **Changes requested.** You get the operator's notes. Rewrite the script applying them. Send it back through the same workflow. Repeat until approved. Do not argue, do not partially apply notes, do not ask clarifying questions unless the note is genuinely ambiguous. --- ## Step 4. Produce the video Call the **HeyGen MCP connector**. Do not use a raw HeyGen API key. Reason: on HeyGen web plans, API keys bill a separate credit wallet that web plans cannot top up. The MCP connector bills your plan credits. Using an API key will fail or charge you twice. Use the **Video Agent**, not the plain avatar render endpoint. Build the prompt from `reference/video-agent-prompt.md`. Fill in: - The **exact approved script**, word for word. Do not paraphrase, do not trim, do not "improve" it at this stage. - `avatarId` from `reference/brand-kit.md` - `voiceId` from `reference/brand-kit.md`, which must be a HeyGen TTS voice Send it as **one single prompt**. One shot. Do not open a back-and-forth conversation with the agent. Do not send follow-up refinement messages. Known limits, so you do not waste time rediscovering them: - The Video Agent endpoint accepts `prompt`, `avatarId`, `voiceId` and `files`. There is no audio asset input. You cannot supply an external voiceover file. Use a HeyGen TTS voice. - Do not attach user-uploaded image or video assets. The agent does not use them reliably. Let it generate all visuals itself. --- ## Step 5. Hand off and stop The MCP call returns a video ID. Take it and stop. **Do not poll. Do not wait for the render. Do not check status in a loop.** Send the video ID, title and description to the logging workflow (Workflow 3), which writes them to the tracking sheet. Workflow 4 handles everything after that on its own. When HeyGen finishes, its webhook fires, n8n matches the row in the sheet, downloads the video, uploads it to YouTube as unlisted, and sends a Telegram notification. That workflow does not involve you. Once you have handed off to Workflow 3, your job on this video is done. Confirm to the operator and end. --- ## Visual direction for the Video Agent These rules go into the prompt. They matter as much as the script. **Do:** - High quality modern graphic design and motion graphics - Vox-explainer style visuals that support the point being made - Generated UI mockups and screen recreations when the script mentions a phone, app or dashboard - AI-generated footage and images when they look clean, realistic and high quality, the way large channels use them - Visuals throughout the video, not just at two or three moments **Never:** - Cyberpunk palettes, neon, glowing grids - Sci-fi or "tech world" imagery, robot hands, floating holograms - Heavy gradients or generic gradient stock imagery - Anything cringe --- ## Brand colors Colors from `reference/brand-kit.md` apply to **three things only**: 1. Subtitles and captions 2. Fonts and text overlays 3. Motion graphics **The avatar's real studio background must never be changed, recolored or replaced with brand colors.** State this explicitly in the Video Agent prompt every time. --- ## What not to do - Do not wait for HeyGen rendering - Do not use a HeyGen API key instead of the MCP connector - Do not send a script through Telegram in full - Do not review or edit a script that arrived in `script` mode - Do not run open-ended vidIQ topic discovery - Do not invent numbers, results or story details - Do not use em dashes