Skip to main content
If your app runs on Convex, including apps built with Convex’s Chef, a video transcript is the feature that breaks once it ships: code that worked on your laptop gets blocked from cloud servers, and many videos have no captions to read. Send the link to Importly from a Convex action instead and save what comes back in a table. This recipe is four files in your convex/ folder:
  • schema.ts adds a transcripts table.
  • importly.ts has the start action your app calls, the internal functions that save a finished job once, and the get query your app reads.
  • http.ts receives Importly’s signed webhook.
  • crons.ts finishes any job whose webhook never arrived.
Your app reads the transcript with useQuery, so it never sees your Importly key, and the page updates on its own when the transcript is saved. Tested with convex 1.51 and convex-test against a mocked API, plus a live call with a bad key.

1. Add your keys

Create your key on the API key page (it is shown once), and copy the Webhook signing secret (it starts with whsec_) from the same page. Set both on your deployment:
Run the same commands with --prod for your production deployment. CONVEX_SITE_URL, which the webhook URL is built from, is set by Convex for you.

2. The table

convex/schema.ts
If you already have a schema, add the transcripts table to it.

3. Start a transcript and save the result

convex/importly.ts
start: "mode": "auto" uses the video’s captions and falls back to speech-to-text when there are none, and webhookUrl points at the HTTP action below. A rejected request (a bad link, a key problem, or a low balance) throws a ConvexError with Importly’s code and message, and nothing is saved. See Error handling. The Promise<Id<'transcripts'>> return type is there because the action returns the result of runMutation: without it, TypeScript can’t infer the type. saveJob and finish: the webhook and the sweep both read the job from the status endpoint with your key, then save it in a mutation that only updates a transcript still queued or running. A second delivery, or the sweep finding a job the webhook already saved, does nothing. Sign-in: the action and the query use ctx.auth, so they work with Convex Auth, Clerk or any other auth provider you’ve set up in Convex.

4. Receive the webhook

convex/http.ts
HTTP actions run in Convex’s default runtime, so the check uses Web Crypto instead of node:crypto. It reads the raw body with request.text(), because the signature covers the exact bytes Importly sent. Right after you rotate the signing secret, Importly sends two v1 signatures for 24 hours, and this check accepts either. See Webhooks. The handler takes only the jobId from the payload, schedules saveJob and answers 200 straight away. saveJob reads the result from the API with your key, so a forged request can’t put data into your app.

5. Sweep up missed webhooks

convex/crons.ts
Each job gets one webhook delivery and no retries. The sweep also covers local development: the webhook URL must be public https://, so a local deployment never receives it, while a cloud dev deployment does.

6. Call it from your app

segments holds the same transcript with start and end times in seconds, for captions, chapters or search. A job that fails later, for example because the video is private, is saved with status: 'failed' and its errorCode and errorMessage.

Downloading the file instead

For the video or audio file itself, start POST /import the same way and save mediaUrl from GET /import/status in saveJob. That link is valid for 7 days, so store the file if your app needs it longer: with store: true, each import is copied to your own S3 or R2 bucket (recipe). Set includeVideo: false for audio only. See Downloads.
A transcript from captions costs $0.003. Speech-to-text for a video without captions is $0.01 per minute, and maxCostDollars stops a long one before it’s charged. Try it free, no card required. See Pricing & credits.

Let your agent write it

Building in Chef, Claude Code or Cursor? Connect the MCP server and ask it to add transcripts with Importly: it reads the same integration guide and can test with a real link first. See Build with your agent.