Skip to navigation

liveTranscribe

View as MarkdownOpen in Claude

Start, summarize, or stop live transcription on the call. Unlike transcribe(), which provides a post-call result, live transcription sends each utterance to your webhook as it is spoken. The action object takes the same shape as the live_transcribe SWML method: a single start, summarize, or stop key. Its keys are sent as written, in snake_case.

See also liveTranslate() for real-time translation, and the transcribe calls guide for the webhook events.

Parameters

action
Record<string, unknown>Required

The action to perform. Set exactly one of start, summarize, or stop.

action.start
object

Start a live transcription session.

action.start.lang
stringRequired

The language to transcribe, such as "en-US".

action.start.direction
string[]Required

The sides of the call to transcribe: "remote-caller", "local-caller", or both.

action.start.webhook
string

The URL that receives transcription events as HTTP POST requests.

action.start.live_events
booleanDefaults to false

Whether to send each utterance to the webhook as it is transcribed.

action.start.ai_summary
booleanDefaults to false

Whether to send an AI summary of the conversation to the webhook when the session ends.

action.start.ai_summary_prompt
string

The prompt that tells the AI how to summarize the conversation when ai_summary is enabled.

action.start.speech_engine
stringDefaults to deepgram

The speech recognition engine: "deepgram" or "google".

action.start.speech_timeout
numberDefaults to 60000

The timeout for speech recognition, in milliseconds.

action.start.vad_silence_ms
numberDefaults to 700 | 500

Voice activity detection silence time, in milliseconds. The default depends on the speech engine: 700 for Deepgram, 500 for Google. Omitting the value or setting it to 0 uses the engine default.

action.start.vad_thresh
numberDefaults to 400

Voice activity detection threshold, from 0 to 1800.

action.start.hints
string[]

Words or phrases that help speech recognition pick out specific terms, such as product names or industry jargon. Empty strings are ignored.

action.summarize
object

Request an AI summary of the conversation so far, while transcription continues. Pass an empty object to send the summary to the webhook from start with the default summary prompt. ai_summary_prompt applies only to the summary sent when the session ends.

action.summarize.webhook
string

The URL that receives the summary.

action.summarize.prompt
string

The prompt that tells the AI how to summarize the conversation.

action.stop
object

Stop the live transcription session. Pass an empty object.

Returns

Promise<Record<string, unknown>> — Server response confirming the operation.

Example

import { RelayClient } from '@signalwire/sdk';
const client = new RelayClient({
project: process.env.SIGNALWIRE_PROJECT_ID!,
token: process.env.SIGNALWIRE_API_TOKEN!,
contexts: ['default']
});
client.onCall(async (call) => {
await call.answer();
// Start live transcription
const result = await call.liveTranscribe({
start: {
lang: 'en-US',
direction: ['remote-caller', 'local-caller'],
webhook: 'https://example.com/transcription-events',
live_events: true,
},
});
console.log('Live transcription started:', result);
// Let the call proceed...
await call.waitForEnded();
});
await client.run();