Integration Guide
Step-by-step approach to integrating Web SDK into your project
Step 1: Install Dependencies
Install the SDK.
Step 2: Initialize
Create an instance of the AvaturnHead
class and initialize it with an optional configuration.
You need to pass a session token obtained from this endpoint (it must be used in the backend).
Make sure to correctly pass a reference to the DOM element (domElement
) depending on your framework (e.g., use ref
in React or Vue, @ViewChild
in Angular, etc.).
Step 3: Send Tasks
Use the task
method to send speech requests. If the avatar is already speaking, the text fragment is queued to be spoken at a later time. Nothing is said while you’re disconnected.
Step 4: Subscribe to Events
Register event listeners to handle specific events during the session.
If you no longer need to listen to an event, you can remove the event listener.
Step 6: Dispose
When you are done with the session, make sure to call the dispose
method to clean up resources.