Discussions

Ask a Question
Back to all

How to send text for TTS in Full Mode (avatar.speak_text command)??

I'm developing a chat application that integrates LiveAvatar in Full Mode. I want the avatar to speak AI-generated text responses from my backend chatbot. I heard that it is possible, and there is command events, but I could not find it working.

Current Setup:
Mode: FULL
Integration: LiveKit Data Channel
Language: Korean (ko)
What I'm trying to do:
When my AI chatbot generates a text response, I want to send that text to the avatar so it can speak it using TTS.
What I've tried:
I've attempted to send the avatar.speak_text command via LiveKit's publishData API in multiple formats:
topic="avatar.speak_text", payload={"text": "Hello"}
No topic, payload={event: "avatar.speak_text", data: {text: "Hello"}}
topic="lk-chat-topic", payload={"text": "Hello"}
// Example codeconst encoder = new TextEncoder();const payload = encoder.encode(JSON.stringify({ text: "Hello" }));await room.localParticipant.publishData(payload, { reliable: true, topic: "avatar.speak_text",});
Result:
Microphone input works perfectly - the avatar responds to my voice input
However, the avatar does not respond to any of the text commands I send via publishData.
No errors are thrown

Questions:
Is avatar.speak_text supported in Full Mode for injecting external text?

If yes, what is the correct format/topic to use?
If not, what is the recommended approach to make the avatar speak custom text in Full Mode?

Environment:
LiveKit Client SDK (JavaScript/TypeScript)
Frontend: Next.js
Backend: Node.js