Talking Character Only
Put just the animated, lip-synced character into your website or app, with no chat window. Visitors can talk to it by voice, and your own code can make it speak a line or answer a question. It uses the same knowledge base, voice, character and usage limits as your project's chat widget.
Fastest route: open your project in the dashboard, go to Embed → Talking character only, try it in the live preview, and copy the snippet. It already contains your project ID.
1. Add it to a page
Add an empty element where the character should appear, then the script. The character fills the element, so size it however you like.
<div id="talkmoji-character" style="width:320px;height:380px"></div>
<script src="https://talkmoji.com/js/talkmoji-character.js"
data-bot="YOUR_PUBLIC_ID"
data-target="#talkmoji-character" defer></script>
Want it as a profile card, hero, banner, full-screen voice stage, header strip or game dialogue instead? See Display Styles.
That's all you need for a character that visitors talk to using its round mic button. These optional attributes change what's shown:
| Attribute | Default | What it does |
|---|---|---|
data-mic="0" | mic shown | Hide the built-in mic button, for example if your app has its own and calls startListening(). |
data-captions="1" | off | Show subtitles of what the character is saying. |
data-greet="0" | greets | Don't speak the project's welcome message when it loads. |
2. Make it talk from your code
const character = TalkmojiCharacter.get('YOUR_PUBLIC_ID');
character.say('Welcome back, Sam!'); // speaks this exact text
character.ask('What are your opening hours?'); // answers out loud from your knowledge base
character.startListening(); // visitor talks to it by voice
character.stopListening();
character.stop(); // cut it off mid-sentence
character.trigger('wave'); // play one of the character's named animations
Calls made before the character has finished loading are queued and run once it's ready.
Without the script-tag auto-mount, you can mount it yourself:
const character = TalkmojiCharacter.mount({
bot: 'YOUR_PUBLIC_ID',
target: document.getElementById('talkmoji-character'),
mic: true,
captions: false,
greet: true,
});
// later: character.destroy();
3. React to what it does
character
.on('ready', (e) => console.log('loaded, can speak:', e.voice))
.on('speaking', () => showTalkingIndicator())
.on('idle', () => hideTalkingIndicator())
.on('message', (e) => console.log('Visitor said:', e.text))
.on('response', (e) => console.log('Character said:', e.answer));
Every event is also dispatched on the target element as a talkmoji:<name> DOM event, for example talkmoji:response, with the same data in event.detail.
| Event | Data | When |
|---|---|---|
ready | { voice } | Loaded. voice: false means it can't speak right now (monthly usage limit reached, or voice not set up). ask() still answers through the response event. |
speaking | none | Audio started. |
idle | none | Audio finished and the mouth is at rest. |
listening / listening-end | none | The mic turned on or off. |
message | { text, sessionId } | What the visitor said or asked. |
response | { answer, sessionId } | The character's full reply text. |
error | { message, code? } | Something went wrong. code: 'voice-unavailable' means say() couldn't be spoken. |
React
import { useRef } from 'react';
import { TalkingCharacter, type TalkingCharacterHandle } from '@avatar-platform/react';
export function Assistant() {
const character = useRef<TalkingCharacterHandle>(null);
return (
<>
<TalkingCharacter
ref={character}
serverUrl="https://talkmoji.com"
botId="YOUR_PUBLIC_ID"
captions
style={{ width: 320, height: 380 }}
onResponse={(e) => console.log(e.answer)}
/>
<button onClick={() => character.current?.say('Hi there!')}>Say hi</button>
</>
);
}
React Native (iOS and Android apps)
import { useRef } from 'react';
import { Button } from 'react-native';
import { TalkingCharacter, type TalkingCharacterHandle } from '@avatar-platform/react-native';
export function AssistantScreen() {
const character = useRef<TalkingCharacterHandle>(null);
return (
<>
<TalkingCharacter
ref={character}
serverUrl="https://talkmoji.com"
botId="YOUR_PUBLIC_ID"
style={{ width: 300, height: 360 }}
onIdle={() => console.log('done talking')}
/>
<Button title="Ask about hours" onPress={() => character.current?.ask('What are your hours?')} />
</>
);
}
Needs react-native-webview and microphone permission, the same setup as the React Native SDK widget.
Vue, Angular and plain JavaScript apps
import { mountTalkingCharacter } from '@avatar-platform/js';
const character = await mountTalkingCharacter({
serverUrl: 'https://talkmoji.com',
botId: 'YOUR_PUBLIC_ID',
target: document.getElementById('talkmoji-character'),
});
character.say('Hello!');
// on teardown: character.destroy();
No JavaScript at all
A plain iframe works too. Visitors use the mic button, and you can't call say() or ask():
<iframe src="https://talkmoji.com/e/YOUR_PUBLIC_ID?mode=character&captions=1"
allow="microphone; autoplay" title="Talking character"
style="width:320px;height:380px;border:0;background:transparent"></iframe>
Good to know
- Browsers block sound until the visitor interacts with the page. Call
say()orask()from a click or tap handler (or after one has happened), not straight on page load. Otherwise the first line may be silent. - say() vs ask():
say()speaks your exact words.ask()treats the text as a visitor question and answers it from your knowledge base.ask()and voice questions count toward your monthly message usage, like the chat widget.say()lines aren't counted as visitor messages and don't appear as visitor turns in your conversation logs. - Voice engine: the character uses the speech engine set in your project's settings. With ElevenLabs, Fish Audio or Cartesia, voice input uses the browser's speech recognition, which works in Chrome and Edge.
- No live-agent handoff in character-only mode, because there's no chat window to hand over to. Lead capture and booking tools still work.
- Allowed domains: if you've restricted your project to certain domains in Settings, the character only loads on those sites, the same as the widget.
- Transparent background: the character is drawn on a transparent background, so it sits on top of whatever is behind its box.