Vanilla Typescript
Complete guide for using @convai/web-sdk with vanilla TypeScript applications (no React or framework required). Use the ConvaiClient class directly, wire up events, and build your own UI.
Installation & Quick Start (Vanilla TypeScript)
Installation
npm install @convai/web-sdkimport { ConvaiClient } from '@convai/web-sdk/vanilla';Quick Start
Basic Example
import { ConvaiClient } from '@convai/web-sdk/vanilla';
async function main() {
const client = new ConvaiClient();
client.on('stateChange', (state) => {
console.log('Agent state:', state.agentState);
});
client.on('message', (message) => {
console.log('Message:', message.content);
});
await client.connect({
apiKey: 'your-api-key',
characterId: 'your-character-id',
endUserId: 'user-uuid', // Optional: enables memory & analytics
});
client.sendUserTextMessage('Hello!');
}
main().catch(console.error);Optional Video Support
About endUserId
Using the Vanilla Widget (Optional)
Last updated
Was this helpful?