transcribe

View as MarkdownOpen in Claude

Start transcribing call audio. Returns a TranscribeAction that you can use to stop the transcription or wait for it to complete.

For real-time transcription with immediate text output, see liveTranscribe(). The transcribe() method starts a background transcription that resolves when the operation finishes.

This method emits calling.call.transcribe events. See Call Events for payload details.

Parameters

controlId
string | undefined

Custom control ID. Auto-generated if not provided.

statusUrl
string | undefined

URL to receive transcription status webhooks.

onCompleted
(event: RelayEvent) => void | Promise<void>

Callback invoked when transcription completes. The event contains the transcription url, duration, and size.

Returns

Promise<TranscribeAction> — An action handle with stop() and wait() methods.

Example

1import { RelayClient } from '@signalwire/sdk';
2
3const client = new RelayClient({
4 project: process.env.SIGNALWIRE_PROJECT_ID!,
5 token: process.env.SIGNALWIRE_TOKEN!,
6 contexts: ['default']
7});
8
9client.onCall(async (call) => {
10 await call.answer();
11
12 // Start transcription
13 const action = await call.transcribe({
14 statusUrl: 'https://example.com/transcription-status',
15 });
16
17 // Let the call proceed...
18 await call.waitForEnded();
19
20 // The transcription result is available after the call ends
21 if (action.result) {
22 const url = action.result.params.url ?? '';
23 console.log(`Transcription available at: ${url}`);
24 }
25});
26
27await client.run();