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

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 transcription
const action = await call.transcribe({
statusUrl: 'https://example.com/transcription-status',
});
// Transcription runs in the background until the call ends
await call.waitForEnded();
});
await client.run();