Handling webhooks with Node SDK
Use webhooks to receive transcription results with the Soniox Node SDK
SDK provides you a helper method to handle Webhooks from the Soniox API and transform them into a typed object.
Configure webhook delivery
If webhook is enabled during transcription creation, Soniox will send a POST request to your webhook URL with the transcription result.
You can also append metadata as query parameters:
Learn more about testing webhooks locally.
Handling webhooks
The SDK provides both framework-agnostic and framework-specific handlers that parse the request body, verify authentication, and return a typed WebhookHandlerResultWithFetch.
All handlers return:
ok— whether the webhook was handled successfullystatus— HTTP status code to return to Sonioxevent— the parsedWebhookEvent(whenok=true)error— error message (whenok=false)fetchTranscript()— lazily fetch the full transcript (whenevent.status === 'completed')fetchTranscription()— lazily fetch the transcription object
handleHono is async because it reads the request body from the Hono context.
Use handleRequest with any framework that provides a standard Fetch API Request object:
handleRequest is async because it reads the request body from the Request object.
The handle method is a framework-agnostic handler. You provide the method, headers, and parsed body directly:
See HandleWebhookOptions for all available options.
Webhook auth helpers
By default, webhook handlers read auth from SONIOX_API_WEBHOOK_HEADER and SONIOX_API_WEBHOOK_SECRET. You can override auth explicitly:
Learn more info about Environment Variables.
But you can also verify the auth manually:
Webhook event helpers
Testing webhooks locally
Since Soniox needs to reach your server over the internet, you'll need a tunnel to expose your local development server. You can use Cloudflare Tunnel or ngrok.
Cloudflare Tunnel provides a quick way to expose your local server — no account required.
Install cloudflared and start a tunnel pointing to your local server:
The command will output a public URL like https://random-name.trycloudflare.com.
ngrok creates a secure tunnel to your local server and provides a stable public URL.
Install ngrok, authenticate, and start a tunnel:
The command will output a public URL like https://abcd-1234.ngrok-free.app.
Once you have your public tunnel URL, use it as the webhook_url when creating a transcription: