Skip to Content
JavaScript SDKExamplesTyping to the character

Typing to the character

During a call the user can type instead of speaking, with sendUserMessage(): the text is their turn, the character stops what it is saying and answers it, by voice and in the captions, using its knowledge and tools as usual. Nothing to switch on.

sendButton.onclick = async () => { const text = messageInput.value; messageInput.value = ""; await client.sendUserMessage(text); };
  • Once sent, the text also arrives as a message with role: "user", final: true and typed: true, so the captions you already show list it in its place.
  • text is 1–2,000 characters; spaces at either end are dropped.
  • At most 20 a minute per session.
  • It resolves once the character has the text, and rejects with an AvatarGoError: not_streaming, invalid_request, session_not_live, rate_limited, or client_controls_disabled in an avatar only session, where there is no character to answer.
  • The session’s transcript has typed turns with the spoken ones.