ConversationRelay WebSocket channel
Single bidirectional channel carrying all ConversationRelay messages. Telnyx-to-customer frames: setup, prompt, eagerEndOfTurn, turnResumed, dtmf, interrupt, error. Customer-to-Telnyx frames: text, play, sendDigits, language, end.
{
"type": "setup",
"sessionId": "7a7e6a4f-1d44-4f0c-b5d4-9f9bf3a5c1f2",
"accountSid": "1f1a8b6f-1234-4abc-9def-1234567890ab",
"callSid": "v2:T02llQxIyaRkhfRKxgAP8nY511EhFLizdvdUKJiSw8d6A9BborherQ",
"callControlId": "v2:T02llQxIyaRkhfRKxgAP8nY511EhFLizdvdUKJiSw8d6A9BborherQ",
"callSessionId": "ff55a038-6f5d-11ef-9692-02420aeffb1f",
"callLegId": "428c31b6-7af4-4b6f-92e7-7a7e6a4f1d44",
"from": "+13122010094",
"to": "+13122123456",
"direction": "inbound",
"callerName": "",
"callStatus": "active",
"customParameters": {
"customer_id": "customer_123"
}
}{
"type": "prompt",
"voicePrompt": "hello there",
"lang": "en",
"last": false
}{
"type": "eagerEndOfTurn",
"voicePrompt": "hello there how are you",
"lang": "en"
}{
"type": "turnResumed"
}{
"type": "dtmf",
"digit": "1"
}{
"type": "interrupt",
"utteranceUntilInterrupt": "Welcome to Telnyx, how can I help",
"durationUntilInterruptMs": 1820
}{
"type": "error",
"description": "Invalid message: unknown type: foo"
}{
"type": "text",
"token": "Hello",
"last": false
}{
"type": "play",
"source": "https://example.com/audio/welcome.mp3"
}{
"type": "sendDigits",
"digits": "1234#"
}{
"type": "language",
"ttsLanguage": "es-ES",
"transcriptionLanguage": "es-ES"
}{
"type": "end"
}First frame Telnyx sends after the WebSocket connects. Identifies the relay session, call, and any custom parameters configured on the assistant.
Transcription of caller speech.
Sent repeatedly during an utterance — last: false marks a partial, last: true marks the final transcript for that utterance.
Sent when the caller has likely finished speaking, before the final prompt.
Only sent when partial prompts are on (Deepgram Flux). voicePrompt is the transcript the final prompt is expected to match, so the application can start generating a reply early.
Sent when the caller keeps speaking after an eagerEndOfTurn. Discard any reply prepared for it.
Sent when a caller pressed a DTMF digit.
Sent when the caller interrupts (barges in over) ongoing TTS playback.
Sent by Telnyx when a customer-sent frame is invalid or another error occurs. The connection may be closed after this frame (after 10 consecutive invalid frames, it will be).
Customer-to-Telnyx frame containing text to be spoken back to the caller via TTS.
For streaming LLM token chunks: send each chunk as a text frame with last: false (or omit last — it defaults to false). Send last: true to finalize the turn.
Important: Omitting last defaults to false. A customer finalizing a turn must send last: true explicitly, otherwise Telnyx will keep waiting for more tokens.
Customer-to-Telnyx frame requesting Telnyx to play an audio file URL into the call.
Customer-to-Telnyx frame requesting Telnyx to send DTMF digits on the call.
Valid characters: 0-9, A-D, w or W (pause), #, *.
Customer-to-Telnyx frame requesting a language change mid-session.
At least one of ttsLanguage (output TTS language) and transcriptionLanguage (input STT language) must be provided.
Customer-to-Telnyx frame ending the ConversationRelay session gracefully.
Optionally carries handoffData — an opaque string forwarded to whatever the assistant hands the call off to next.
Was this page helpful?
{
"type": "setup",
"sessionId": "7a7e6a4f-1d44-4f0c-b5d4-9f9bf3a5c1f2",
"accountSid": "1f1a8b6f-1234-4abc-9def-1234567890ab",
"callSid": "v2:T02llQxIyaRkhfRKxgAP8nY511EhFLizdvdUKJiSw8d6A9BborherQ",
"callControlId": "v2:T02llQxIyaRkhfRKxgAP8nY511EhFLizdvdUKJiSw8d6A9BborherQ",
"callSessionId": "ff55a038-6f5d-11ef-9692-02420aeffb1f",
"callLegId": "428c31b6-7af4-4b6f-92e7-7a7e6a4f1d44",
"from": "+13122010094",
"to": "+13122123456",
"direction": "inbound",
"callerName": "",
"callStatus": "active",
"customParameters": {
"customer_id": "customer_123"
}
}{
"type": "prompt",
"voicePrompt": "hello there",
"lang": "en",
"last": false
}{
"type": "eagerEndOfTurn",
"voicePrompt": "hello there how are you",
"lang": "en"
}{
"type": "turnResumed"
}{
"type": "dtmf",
"digit": "1"
}{
"type": "interrupt",
"utteranceUntilInterrupt": "Welcome to Telnyx, how can I help",
"durationUntilInterruptMs": 1820
}{
"type": "error",
"description": "Invalid message: unknown type: foo"
}{
"type": "text",
"token": "Hello",
"last": false
}{
"type": "play",
"source": "https://example.com/audio/welcome.mp3"
}{
"type": "sendDigits",
"digits": "1234#"
}{
"type": "language",
"ttsLanguage": "es-ES",
"transcriptionLanguage": "es-ES"
}{
"type": "end"
}