Skip to main content
The widget emits events that let you respond to user interactions and chat activity in your application.

Configuration callbacks

The simplest way to handle events is through callback functions in your configuration:

Event listener API

For more control, use the on() and off() methods to subscribe to events dynamically.

on(event, handler)

Subscribe to an event.
Returns: A function to remove the listener.

off(event, handler?)

Remove event listeners.

Available events

Widget events

Chat events

Feedback events

Authentication events

Event payloads

chat:send

Fired when a message is sent.

chat:complete

Fired when a response has finished.

auth:ready

Fired when the widget has finished restoring or resolving the current auth state.

auth:login

Fired when a user logs in.

auth:logout

Fired when a user logs out.

auth:sign-in-click

Fired when a user clicks a sign-in button inside the widget. Use authClickEvents.mode to choose what happens next:
  • observe keeps the normal widget auth flow
  • intercept stops the normal widget auth flow so your page can handle auth itself
If you use intercept, widget button clicks stop at the event, but voltai.login() and voltai.logout() still work normally.

auth:sign-out-click

Fired when a user clicks the sign-out button inside the widget.

auth:error

Fired when an authentication error occurs.

feedback:submit

Fired when a user submits feedback on a response.

Example: Analytics integration

Track widget usage with your analytics provider:

Example: Chat activity logging

Log user messages and AI responses using the callback API:

Example: Feedback tracking

Track user feedback using the callback API:

Example: Cleanup on unmount

In a single-page app, clean up listeners when navigating away:
The on() method returns an unsubscribe function. Store it if you need to remove the listener later.