# HeyGen video completion: webhooks first, polling every 10s as the fallback

## TL;DR

Build both paths. Use webhooks as the primary completion signal in production (public HTTPS endpoint, handle avatar_video.success and avatar_video.fail, update your records idempotently). Keep a polling fallback that checks GET /v3/videos/{video_id} every 10 seconds for local dev and as a safety net; if the webhook path is silent for longer than your polling timeout, fall back to the status endpoint rather than assuming failure.

Use this when you run into the situation in the title.

**When not to use this skill:** unrelated tasks. It covers only the procedure above.

## Compatibility

The steps above apply to the commands named in them. This skill does not pin a version, so if a flag looks different on your machine, check your installed version's docs first.

## Details

Context: GitHub integration notes (mediamake HeyGen webhook setup, real production walkthrough): documents the two completion patterns. The default is the webhook: HeyGen calls your endpoint with avatar_video.success or avatar_video.fail when the video is ready, and the handler updates the database. Polling is the fallback: it runs automatically in the background every 10 seconds against the status endpoint, and it is what you use for local development without a public URL or as a safety net if a webhook never arrives. Production webhooks require a publicly accessible HTTPS endpoint with no firewall blocking the route.
