Configuration
Client Token Mode allows the widget to communicate directly with the Travrse API. Get your token from the Travrse Dashboard.
Not initialized
Usage Examples
The simplest way to embed — just add a script tag with your token:
<!-- Single script tag -->
<script
src="https://cdn.jsdelivr.net/npm/vanilla-agent/dist/install.global.js"
data-travrse-token="ct_live_..."
></script>
Use window.siteAgentConfig for more control:
<script>
window.siteAgentConfig = {
clientToken: 'ct_live_...',
flowId: 'flow_01abc...',
onSessionInit: (session) => {
console.log('Connected!');
}
};
</script>
For full control, initialize programmatically:
import { initAgentWidget } from 'vanilla-agent';
const controller = initAgentWidget({
target: '#chat',
config: {
clientToken: 'ct_live_...',
onSessionExpired: () => {
showRefreshPrompt();
}
}
});