Skip to main content
The same agent that takes voice calls can hold a text chat. A chat never asks for the microphone and plays no audio: the visitor types, and the agent’s replies stream into your page.

Start a chat

With a call token, also send isChatOnly: true when your server asks for the token. The agent’s greeting arrives as its first message.

Send the visitor’s message

sendMessage() throws if the chat hasn’t started, or if the text is empty. chatMessageReceived brings you the agent’s messages, so show the visitor’s message yourself when they send it, as above.

Show the agent’s replies as they stream in

chatMessageReceived fires several times for one reply while the agent writes it, then once more when it’s complete. Each message has:

Show that the agent is typing

End the chat

Good to know

  • chatMessageReceived fires only for chats. messageReceived also fires for chat, but it fires for voice transcripts as well, so prefer chatMessageReceived for a chat window.
  • In a chat, the voice events (transcriptionReceived, answerReceived) and the audio events don’t fire.
  • A chat is a call: it has a jobId, shows in Call history, and sends the agent’s webhook.

Events

Every event the SDK sends.

Start calls

Keys, call tokens, and why a chat can’t start.