New Javascript SDK [1.2.0]
Last updated
Last updated
Register your site's domain to call the Klleon API.
Domain registration is available in the SDK Management section of .
If any issues arise, please contact partnership@klleon.io
Include the JavaScript SDK file in your web page.
Specify the SDK version in the script
tag.
Initialize the SDK using the init()
method.
Required options:
sdk_key
avatar_id
Event Handlers
onChatEvent
: Handles chat events.
onStatusEvent
: Manages status events.
UI Components
<avatar-container />
: Renders avatar streaming as a Web Component.
<chat-container />
: Renders the chat interface as a Web Component.
Lifecycle Methods
init
: Initializes the SDK, connecting sockets and streaming.
destroy
: Ends the SDK session and cleans up resources.
Chat Methods
sendTextMessage
: Sends a text message.
echo
: Implements a message echo function. Repeats the exact input text as speech.
startStt / endStt
: Records and sends voice messages.
Additional Methods
changeAvatar
: Changes the avatar.
clearMessageList
: Clears the message list.
stopSpeech
: Stops the avatar's speech.
Use for SDK type definitions and apply them to tsconfig.json
.