Generate AI Videos with HeyGen and n8n Automation

This workflow automates AI video creation using HeyGen’s avatars and voices within n8n, solving the problem of manual video production delays and complexity. Quickly generate, check status, and retrieve video URLs seamlessly.
httpRequest
manualTrigger
wait
+3
Workflow Identifier: 1563
NODES in Use: manualTrigger, wait, set, if, httpRequest, stickyNote
Automate AI videos with HeyGen and n8n

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What This Workflow Does

This workflow helps make videos with AI avatars automatically using HeyGen’s API. It fixes the problem of having to watch and check video creation many times by itself. It sends a request to create a video, waits some time, checks if the video is done, and then gives you the video link to download.

You save hours and avoid errors by not repeating manual API calls or status checks. The final result is a video URL ready to use without you clicking many buttons.


Who Should Use This Workflow

This workflow is for content creators who make many AI avatar videos using HeyGen. It fits people who want to save time on manual video management and video status tracking.

It works well for people who know how to run n8n workflows but do not want to write complex code or keep checking their video generation progress by hand.


Tools and Services Used

  • HeyGen API: Creates AI avatar videos and returns video creation status.
  • n8n Automation Platform: Runs the workflow, connects API calls, and controls timing.
  • Custom Auth Credentials in n8n: Store HeyGen API Key safely for authentication.

Inputs, Processing Steps, and Outputs

Inputs

  • avatar_id: The ID for the AI avatar to use in the video.
  • voice_id: The voice ID to speak the input text.
  • text: The script the avatar will say in the video.
  • API key: HeyGen API key used to authenticate requests.

Processing Steps

  • Send video creation request with avatar_id, voice_id, and text using HeyGen API.
  • Wait a set amount of time (default 10 seconds) to give HeyGen time to generate the video.
  • Check video generation status by querying HeyGen with the returned video ID.
  • Use a conditional check to see if video status is “completed”.
  • If not completed, the workflow waits again and checks status repeatedly.

Output

  • Once completed, output the downloadable video URL.

Beginner Step-by-Step: How to Use This Workflow in n8n

1. Import the Workflow

  1. Download the workflow JSON file using the Download button on this page.
  2. Open your n8n editor interface.
  3. Click on “Import from File” and select the downloaded file.

2. Configure Credentials and Settings

  1. Go to “Credentials” in n8n and add Custom Auth credentials with header name “X-Api-Key” and your HeyGen API Key as the value.
  2. Update the Config node with your chosen avatar_id, voice_id, and text for the video.
  3. If needed, adjust wait time in the Wait node.

3. Test the Workflow

  1. Run the workflow manually by clicking “Test workflow” on the Manual Trigger node.
  2. Watch the execution and confirm the output gives you the video URL.

4. Activate for Production

  1. Switch the workflow ON to allow automatic running.
  2. Replace the Manual Trigger if needed with another trigger (schedule or webhook) for full automation.

If running self hosting n8n or hosting n8n on a server, consider trusted services such as self-host n8n for reliable performance.


Common Edge Cases and Failures

If an authentication error like 401 happens, double-check the HeyGen API Key in the Custom Auth credential and ensure header name is exactly “X-Api-Key”.

If the workflow loops without video completing, the video may take longer. Try increasing delay in the Wait node.

Also add logic to detect failed statuses from HeyGen to avoid endless loops.


Customization Ideas

  • Adjust Wait node delay to fit how long videos take in usual conditions.
  • Make Config node text dynamic by connecting external form inputs or other triggers.
  • Swap different avatar and voice IDs to vary the presenters.
  • Add error handling nodes after status check to manage failed or error responses.

Summary of Results

✓ Automates AI video creation from text input, avatar, and voice IDs.

✓ Saves time by stopping manual status polling and API calling.

✓ Produces direct downloadable video URLs for fast content use.

→ Simplifies video production and allows more time for creativity.

→ Improves reliability by reducing manual errors and delays.


Sample JSON for Video Creation HTTP Request Node Body

Use this JSON body in the Create Video HTTP Request node. It uses expressions for dynamic data:

{
  "video_inputs": [
    {
      "character": {
        "type": "avatar",
        "avatar_id": "{{ $json.avatar_id }}",
        "avatar_style": "normal"
      },
      "voice": {
        "type": "text",
        "input_text": "{{ $json.text }}",
        "voice_id": "{{ $json.voice_id }}",
        "speed": 1
      }
    }
  ],
  "caption": true,
  "dimension": {
    "width": 1080,
    "height": 1920
  }
}

This JSON tells HeyGen which avatar and voice to use and what text the avatar should speak.


Automate AI videos with HeyGen and n8n

Visit through Desktop to Interact with the Workflow.

Author
Written By
Vikash Kumar
Building AI agents, n8n workflows and end-to-end automation for 30+ Brands across India, the US, Europe, Dubai & Australia. 7+ years of Experience saving founders real hours every week - no code required.
Author
Written By
Vikash Kumar
Building AI agents, n8n workflows and end-to-end automation for 30+ Brands across India, the US, Europe, Dubai & Australia. 7+ years of Experience saving founders real hours every week - no code required.

Frequently Asked Questions

Check the HeyGen API key in the n8n Custom Auth credentials. Ensure the header name is exactly “X-Api-Key” and the API key value is correct.
Increase the wait time in the Wait node to allow more generation time. Also add logic to handle failed status to avoid infinite loops.
Yes, but be cautious of HeyGen API rate limits and control concurrency within n8n to avoid errors.
Yes, API keys are stored securely in n8n credentials with encryption and used only over HTTPS connections.

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.