Advice and answers from the UserGuiding Team
Users
Engagement
Settings
AI Assistant
Learn how to utilize the UserGuiding's JavaScript API AI Assistant methods

Launch AI Assistant

Displays the AI Assistant launcher. 


Type Definition

type launchAiAssistant = () => void


Example:

Shows the AI Assistant launcher on the page


userGuiding.launchAiAssistant();


Expand AI Assistant

Expands the AI Assistant’s chat widget. If the assistant launcher is present (visible as a launcher), this will open the whole assistant conversation window.

Optionally pass a message to pre-fill the chat input. The widget opens on a new chat with the text in the input. The message is not sent automatically; the user reviews and sends it.


Type Definition

type expandAiAssistant = (options?: { message?: string }) => boolean


Parameters

options.message (string, optional): Text to pre-fill in the chat input.


Return Value

true when the widget opens. false when it cannot open: the user is not identified, no AI Assistant is active for the user, or the usage limit has been reached. You can use this to fall back to another help resource.


Example:

Opens the AI Assistant chat window


userGuiding.expandAiAssistant();


Example:

Opens the AI Assistant on a new chat with a question pre-filled


userGuiding.expandAiAssistant({ message: 'How do I export my invoices?' });


Example:

Falls back to your help center when the AI Assistant cannot open


const opened = userGuiding.expandAiAssistant({ message: 'How do I export my invoices?' });
if (!opened) {
  window.open('https://help.example.com', '_blank');
}


Collapse AI Assistant Widget

Collapses the AI Assistant widget. If the AI Assistant’s chat window is currently open, this will minimize it back to the launcher icon.


Type Definition

type collapseAiAssistant = () => void


Example:

Minimizes the AI Assistant chat window


userGuiding.collapseAiAssistant();



Hide AI Assistant

Completely hides the AI Assistant from view. This removes the assistant’s launcher.


Type Definition

type hideAiAssistant = () => void


Example:

Removes the AI Assistant from the page


userGuiding.hideAiAssistant();


Did this answer your question?
Ask AI
Responses are generated using AI and may contain mistakes.
How can I help you?
Ask me anything about our product. I can help you find answers across the knowledge base.
Ask a question...Ctrl+I