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

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

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

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.


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.

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free