Skip to main content
The Voltai.load() function returns an instance with methods to control the widget from your code.

Widget visibility

open()

Opens the chat panel. If the visitor does not already have a guest or signed-in session, the widget opens into its verification step first. After verification completes, the chat UI appears automatically.

close()

Closes the chat panel.

toggle()

Toggles the chat panel open or closed.
Use these methods to integrate the widget with your own UI. For example, open the chat when a user clicks a “Need help?” button.

Sending messages

sendChat(query, options)

Sends a chat message programmatically. This lets you start conversations from your own code, like a search box or help button. If the visitor does not already have a guest or signed-in session, the widget opens, keeps the latest queued query, shows the verification step, and submits the message automatically after verification succeeds.
Parameters: Options: Returns: Promise<void>

Example: Basic usage

Example: Start a new chat

Example: Combined with open

sendChat() no longer requires you to pre-authenticate the visitor yourself. If verification is needed, the widget handles it inline and submits the latest queued message afterward.
If multiple sendChat() calls are made before verification completes, the latest pending message replaces any earlier unsent one.

Authentication

login()

Opens the login popup for users to sign in. You can call this before the widget is opened. If the widget is still finishing its initial auth bootstrap, the SDK waits until auth is ready and then runs the login flow.

logout()

Logs out the current user and clears their session.

isLoggedIn()

Returns whether a user is signed in. Returns false for guest users, and also returns false until auth initialization has settled.
Returns: boolean

isAuthReady()

Returns whether the widget has finished restoring the current auth state.
Returns: boolean

Cleanup

destroy()

Removes the widget from the page and cleans up all resources.
Use this when:
  • Navigating away in a single-page app
  • Conditionally removing the widget
  • Reinitializing with different settings

Complete example

Here’s a page with custom buttons to control the widget: