AutomationFlowsWeb Scraping › Generate Custom AI Videos with Digital Avatars Using Heygen API

Generate Custom AI Videos with Digital Avatars Using Heygen API

ByAbdellah Homrani @adamcrafts on n8n.io

This automation connects directly to HeyGen's powerful AI video generation platform. It allows you to programmatically create videos with digital avatars and voiceovers, perfect for scaling your content creation for social media, marketing campaigns, or personalized messages…

Manual trigger★★☆☆☆ complexity6 nodesHTTP Request
Web Scraping Trigger: Manual Nodes: 6 Complexity: ★★☆☆☆ Added:

This workflow corresponds to n8n.io template #4622 — we link there as the canonical source.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "nodes": [
    {
      "id": "97dcf679-2312-4f61-aff2-ca1fe05ed94b",
      "name": "HeyGen",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        -440,
        -260
      ],
      "parameters": {
        "url": "https://api.heygen.com/v2/video/generate",
        "method": "POST",
        "options": {
          "redirect": {
            "redirect": {}
          }
        },
        "jsonBody": "={\n  \"video_inputs\": [\n    {\n      \"character\": {\n        \"type\": \"avatar\",\n        \"avatar_id\": \"{{ $json.AvatarId ?? \"Amy_standing_outdoor_side\"}}\",\n        \"avatar_style\": \"normal\"\n      },\n      \"voice\": {\n        \"type\": \"text\",\n        \"input_text\": \"{{ $json.full_script }}\",\n        \"voice_id\": \"{{ $json.HeygenVoiceId ?? '26b2064088674c80b1e5fc5ab1a068eb' }}\"\n      },\n      \"background\": {\n        \"type\": \"color\",\n        \"value\": \"#000000\"\n      }\n    }\n],\n  \"dimension\": {\"width\": \"340\",\"height\": \"340\"}\n}\n",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "660db08f-5b5c-4fd0-aa3b-660619108a1a",
      "name": "Wait4",
      "type": "n8n-nodes-base.wait",
      "position": [
        -140,
        -280
      ],
      "parameters": {
        "amount": 30
      },
      "typeVersion": 1.1
    },
    {
      "id": "32126f57-2d00-465a-a642-3fbecd96943d",
      "name": "HeyGen : Check Video",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        80,
        -280
      ],
      "parameters": {
        "url": "https://api.heygen.com/v1/video_status.get",
        "options": {
          "redirect": {
            "redirect": {}
          }
        },
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "video_id",
              "value": "={{ $('HeyGen').first().json.data.video_id }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "157b890c-9684-4695-b110-5a94cc044ccd",
      "name": "heygen_response",
      "type": "n8n-nodes-base.switch",
      "position": [
        380,
        -300
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "completed",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.data.status }}",
                    "rightValue": "completed"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "processing",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "46dfa599-fe04-4b32-8d15-09e963099737",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.data.status == 'processing' || $json.data.status == 'pending' || $json.data.status == 'waiting' }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "failed",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "22c93926-40a2-49ef-b8f0-aa718da00792",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.data.status }}",
                    "rightValue": "failed"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "a4fe631d-58df-4760-9d25-22199f3a6530",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -100,
        -40
      ],
      "parameters": {
        "width": 390,
        "height": 80,
        "content": "## HeyGen APi generate Video"
      },
      "typeVersion": 1
    },
    {
      "id": "7867d3bd-d03c-41b3-909b-b1a6540023a7",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -840,
        -740
      ],
      "parameters": {
        "width": 500,
        "height": 380,
        "content": "# AdamCrafts\n\nHey there! I'm Adam. \ud83d\ude80 I specialize in helping people master n8n, land their first client, and scale their automation business efficiently. Let's automate your success!\n\n## Need Help? \ud83d\udcde\n Detailed documentation included in the workflow package covers advanced configuration options and optimization techniques.\n\n\n\u2764\ufe0f Buy more workflows at: [adamcrafts](https://adamcrafts.cloudysoftwares.com)\n\ud83e\uddbe Custom workflows at: [adamcrafts@cloudysoftwares.com](mailto:adamcrafts@cloudysoftwares.com)\n[adamaicrafts@gmail.com](mailto:adamaicrafts@gmail.com)"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Wait4": {
      "main": [
        [
          {
            "node": "HeyGen : Check Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HeyGen": {
      "main": [
        [
          {
            "node": "Wait4",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "heygen_response": {
      "main": [
        [],
        [
          {
            "node": "Wait4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HeyGen : Check Video": {
      "main": [
        [
          {
            "node": "heygen_response",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This automation connects directly to HeyGen's powerful AI video generation platform. It allows you to programmatically create videos with digital avatars and voiceovers, perfect for scaling your content creation for social media, marketing campaigns, or personalized messages…

Source: https://n8n.io/workflows/4622/ — original creator credit. Request a take-down →

More Web Scraping workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Web Scraping

PDF to Markdown Converter (LlamaCloud) Description: How it works This workflow extracts structured content from complex PDFs using LlamaCloud's advanced parsing engine:

HTTP Request, Google Drive
Web Scraping

Credential. Uses httpRequest. Manual trigger; 12 nodes.

HTTP Request
Web Scraping

ATARYS - Template Extraction de Données. Uses httpRequest. Manual trigger; 8 nodes.

HTTP Request
Web Scraping

API Integration. Uses start, httpRequest, json. Manual trigger; 4 nodes.

Start, HTTP Request, JSON
Web Scraping

Fluxo Ia Evasao Import. Uses itemLists, httpRequest. Manual trigger; 4 nodes.

Item Lists, HTTP Request