Skip to main content
If your app sends video or podcast links to Inngest functions, the media step is the one that breaks once it runs on a server: sites block datacenter IPs, and many videos have no captions to read. Call Importly from a step instead. It returns the transcript, a download link for the file, or the video’s details, for links from YouTube, TikTok, Instagram, X, podcasts and 1,000+ other sites. Long imports can take a few minutes. The functions below start the job in one step, then step.sleep and check the job’s status until it’s done. A sleeping function isn’t running, and each check is its own step, so a retry never starts the job twice. This page uses the inngest v3 SDK and plain fetch.

1. Add your key

Create your key on the API key page (it is shown once). Add it as IMPORTLY_API_KEY to the environment where your app serves Inngest functions, and to .env for local development:
.env

2. A small client

Both functions share one helper. A 429 throws a RetryAfterError with the retryAfter the API sent, so Inngest retries the step after that wait. A 400 (a bad link), 401 (a wrong key) or 402 (balance too low) won’t change on a retry, so they throw a NonRetriableError. Anything else is a normal error, and Inngest retries the step:
inngest/importly.ts
inngest/client.ts
"mode": "auto" uses the video’s captions and falls back to speech-to-text when it has none. wait: true holds the request open for up to 30 seconds, so a transcript from captions usually comes back from the first step. Otherwise the function sleeps and checks:
inngest/transcribe-link.ts
A caption transcript costs $0.003; speech-to-text is billed per minute, and maxCostDollars caps what one link can cost. More options are in Transcripts.

4. Download the file

POST /import returns a job ID straight away. The concurrency limit keeps at most 10 imports in progress from this function:
inngest/import-link.ts
mediaUrl is valid for 7 days. To keep files, copy them to your storage in a next step, or connect your bucket once and import with store: true so every file lands there (Save to your bucket).

Run it

Add both functions to your serve() handler, start the Inngest dev server with npx inngest-cli@latest dev, and send an event from your app’s backend:

Notes

Why not a webhook? step.waitForEvent only sees events sent after the wait starts, and a short video can finish before that. Polling from durable steps avoids the race and needs no webhook setup. If you do route Importly’s webhook into Inngest, keep a status check after a null (timed-out) wait. Status endpoints allow 3,600 requests per hour per job type. A check every 20 seconds is 180 an hour for each job in progress, so about 20 jobs can poll at once; the concurrency limit keeps you under that. POST /import allows 240 requests per hour per key, and an account can have 50 imports queued or running at once. For hundreds of links, see Batch imports. A youtube.com/playlist?list=… link is rejected with PLAYLIST_NOT_SUPPORTED. Send one event per video instead.