Skip to main content

Overview

Client events are messages sent from the frontend to the Unmute backend server. These events control session configuration and stream audio data.

session.update

Configure the conversation session, including voice selection and conversation instructions. The backend requires this event before it begins processing. Send this immediately after connecting.

Parameters

string
required
Must be "session.update"
string
required
Unique event identifier (auto-generated)
object
required
Session configuration object
object
Conversation instructions (Unmute extension)
string
Character personality and behavior
string
Conversation scenario or context
string
Voice identifier for text-to-speech. Get available voices from /v1/voices endpoint.
boolean
required
Whether to allow recording of the conversation. Set to false to disable recording.

Example

Response

The server responds with a session.updated event confirming the configuration.

input_audio_buffer.append

Stream audio data from the user’s microphone to the server.

Parameters

string
required
Must be "input_audio_buffer.append"
string
required
Unique event identifier (auto-generated)
string
required
Base64-encoded Opus audio dataAudio Specifications:
  • Codec: Opus
  • Sample Rate: 24 kHz
  • Channels: Mono
  • Encoding: Base64 string

Example

Implementation Notes

  • The server decodes the base64 audio and processes it through an Opus stream reader
  • The first packet must have the “beginning of stream” bit set (bit 2 in byte 5)
  • Audio is processed in real-time for speech detection and transcription
  • The server may send input_audio_buffer.speech_started when speech is detected

JavaScript Example


Error Handling

If the client sends invalid messages, the server responds with an error event:

Invalid JSON

Invalid Message Structure

Next Steps

Server Events

Learn about events sent from server to client

Session Management

Configure voice and conversation settings