Rate this page:

ConversationalAIClient

Methods

addEventListener

Copy URL
addEventListener(event: 

Events

|

ConversationalAIEvents

,
callback:

Function

):

void

Adds a handler for the specified ElevenLabs.ConversationalAIEvents or ElevenLabs.Events event. Use only functions as handlers; anything except a function leads to the error and scenario termination when a handler is called.

Parameters

Returns

  • type:

    void

clearMediaBuffer

Copy URL
clearMediaBuffer(parameters: 

ClearMediaBufferParameters

):

void

Clears the ElevenLabs WebSocket media buffer.

Parameters

Returns

  • type:

    void

clientToolResult

Copy URL
clientToolResult(parameters: 

Object

):

void

Parameters

  • parameters:

    Object

Returns

  • type:

    void

close

Copy URL
close(): 

void

Closes the ElevenLabs connection (over WebSocket) or connection attempt.

Returns

  • type:

    void

contextualUpdate

Copy URL
contextualUpdate(parameters: 

Object

):

void

Allows to send non-interrupting background information to the conversation. https://elevenlabs.io/docs/conversational-ai/api-reference/conversational-ai/websocket#send.Contextual-Update

Parameters

  • parameters:

    Object

Returns

  • type:

    void

conversationInitiationClientData

Copy URL
conversationInitiationClientData(parameters: 

Object

):

void

Parameters

  • parameters:

    Object

Returns

  • type:

    void

id

Copy URL
id(): 

string

Returns the ConversationalAIClient id.

Returns

  • type:

    string

removeEventListener

Copy URL
removeEventListener(event: 

Events

|

ConversationalAIEvents

,
callback:

Function

):

void

Removes a handler for the specified ElevenLabs.ConversationalAIEvents or ElevenLabs.Events event.

Parameters

Returns

  • type:

    void

sendMediaTo

Copy URL
sendMediaTo(mediaUnit: 

VoxMediaUnit

,
parameters:

SendMediaParameters

):

void

Starts sending media from the ElevenLabs (via WebSocket) to the media unit. ElevenLabs works in real time.

Parameters

Returns

  • type:

    void

stopMediaTo

Copy URL
stopMediaTo(mediaUnit: 

VoxMediaUnit

):

void

Stops sending media from the ElevenLabs (via WebSocket) to the media unit.

Parameters

Returns

  • type:

    void

userMessage

Copy URL
userMessage(parameters: 

Object

):

void

Allows to send user text messages to the conversation.

Parameters

  • parameters:

    Object

Returns

  • type:

    void

webSocketId

Copy URL
webSocketId(): 

string

Returns the ElevenLabs WebSocket id.

Returns

  • type:

    string