n8n Tutorial12 min readJuly 11, 2026

Connect HeyGen to Your CRM with n8n

By Umar Asghar, AI Integration Engineer - July 11, 2026

TL;DR

You will build an n8n workflow that watches HubSpot for a deal stage change, pulls the contact’s name and company, calls the HeyGen video generation API, waits for the render, and writes the video link back to the deal - plus the three error handlers that separate a demo from production. Honest ceiling: this pattern holds to roughly 50 videos a day. Past that you need queue management and monitoring, covered at the end.

What You Need Before You Start

This is the n8n workflow that connects HeyGen to HubSpot. You need four things: a HeyGen API key (Settings, then API - requires a paid plan), an n8n instance (cloud or self-hosted), a HubSpot account with workflow permissions, and about 45 minutes.

One warning. Every step here works on the first test. The gap between “works once” and “works on contact 4,000” is Step 6. Do not skip it.

Step 1: Set Up the HeyGen API Credential in n8n

n8n has no native HeyGen node, so you will use the HTTP Request node with a stored credential. Do not paste your key into node parameters - it ends up in workflow exports and execution logs.

  1. In n8n, create a new Header Auth credential.
  2. Header name: X-Api-Key. Value: your HeyGen API key.
  3. Name it HeyGen API so every HTTP Request node can reuse it.

The base URL for everything in this guide is https://api.heygen.com. You will hit three endpoints:

POST /v2/video/generate - starts a render

GET /v1/video_status.get - checks render status

GET /v2/avatars - lists your avatar IDs

Step 2: Trigger on a HubSpot Deal Stage Change

Skip n8n’s HubSpot Trigger node here. Its deal property subscriptions fire on every deal update, so you spend a Filter node discarding noise. Instead, point a HubSpot Workflow at an n8n Webhook node:

  1. In n8n, add a Webhook node. Method POST. Copy the production URL.
  2. In HubSpot, create a Workflow with the enrollment trigger “Deal stage is any of: [your target stage]”.
  3. Add a “Send a webhook” action pointed at your n8n URL. Include the deal ID and associated contact ID in the payload.

Step 3: Extract the Personalization Data

Add a HubSpot node (operation: Contact, Get) using the contact ID from the webhook, then a Set node that maps: first_name, company, and deal_context.

Now add an IF node that checks all three fields are non-empty. A missing first name does not fail the API call - it produces a video greeting your prospect as an empty string. Route empty-field contacts to a Slack notification instead of a render.

Step 4: Call the HeyGen Video Generation Endpoint

Add an HTTP Request node. Method POST, URL https://api.heygen.com/v2/video/generate, body type JSON. The payload includes video_inputs with your avatar_id, voice settings, and the personalization variables. Set test: true while building - test renders are watermarked but do not burn credits. The response contains a video_id inside data. Store it with a Set node.

Step 5: Handle the Async Render (Polling vs Webhook)

HeyGen renders asynchronously. A typical avatar video takes 1 to 5 minutes. Polling is simpler: Wait node (90 seconds), then GET /v1/video_status.get, then IF on data.status. If completed, continue. If processing, loop back. If failed, route to error branch. Cap at 10 iterations.

Webhooks are cleaner at volume. Register an endpoint via POST /v1/webhook/endpoint.add and HeyGen POSTs on avatar_video.success and avatar_video.fail events. Use polling under 20 videos a day; switch to webhooks past that.

Step 6: Add Error Handling Before You Go Live

This is the step every tutorial skips and every production incident traces back to. Three handlers:

Rate limit backoff

In the HTTP Request node, enable Retry On Fail with 3 max tries and a 5000ms wait, so a burst of deals does not drop the last few videos silently.

Avatar-not-found alert

If someone renames or deletes an avatar in the HeyGen dashboard, every render starts failing. Catch this error and route it to a dedicated alert - retrying will not fix it.

Failed-video Slack alert

Add an Error Workflow in n8n that posts the workflow name, failed node, and error message to Slack. A failed render with no alert is a lead that silently fell out of your pipeline.

Step 7: Deliver the Video Link

You have data.video_url. One caveat: HeyGen’s URL expires after 7 days. For same-day outreach the direct URL is fine; for anything else, download the file and re-host it. The simplest option: a HubSpot node updates a custom deal property like personalized_video_url, and a second HubSpot workflow sends the email using that property.

Where This Pattern Hits Its Ceiling

This guide gets you to about 50 videos a day. Past that, three things break: retry logic in n8n is per-node and stateless (cannot queue-manage across workers), polling loops multiply and strain your instance, and you lose visibility into aggregate failure rates. None of this means abandoning n8n - it means adding a queue layer, webhook-based completion, and monitoring in front of it.

Hitting That Ceiling? Start with a Pipeline Audit

If you have built this and volume is breaking it - or you want the production version from day one - the Pipeline Audit starts with your current setup and outputs a production architecture blueprint. 30 minutes, yours whether or not we build anything.

Get your Pipeline Audit

FAQ

Does HeyGen have a native n8n node?

No. You use n8n's HTTP Request node with a Header Auth credential (X-Api-Key) against https://api.heygen.com. This guide covers the three endpoints you need.

How much does each video cost through the API?

HeyGen bills renders in credits; pricing varies by plan and video length. Test renders (test: true) are watermarked and free. Run your real volume through your plan's credit math before launch - at 50 videos a day the API line item is real money.

Can I use this with Salesforce instead of HubSpot?

Yes. Replace Steps 2 and 3 with a Salesforce Flow calling an n8n webhook, and the Step 7 write-back with n8n's Salesforce node. Steps 4 through 6, the HeyGen side, are identical.

Why did my render fail with an avatar error?

Usually the avatar_id changed - someone renamed or deleted the avatar in the HeyGen dashboard. Re-run GET /v2/avatars, update the ID, and add the Step 6 alert so the next dashboard change pages you instead of failing silently.

Polling or webhooks - which should I use?

Polling under 20 videos a day, webhooks above that. Polling keeps one readable workflow; webhooks scale without filling your n8n instance with sleeping executions.

ABOUT THE AUTHOR

Umar Asghar is the CTO of Kastiv. He builds AI video and CRM integrations for sales teams and marketing ops teams.