transcribe

View as MarkdownOpen in Claude

Transcribe the entire call in the background. Returns a TranscribeAction that you can use to stop the transcription or wait for it to complete.

The transcribe() method transcribes the whole call and resolves when it finishes. For real-time transcription delivered as the call happens, see liveTranscribe() instead.

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 carries the recording’s 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_API_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 // Transcription runs in the background until the call ends
18 await call.waitForEnded();
19});
20
21await client.run();