window.BubblaV object that allows you to control the widget and search interface programmatically, as well as listen for events.
Methods
BubblaV.open()
Opens the chat widget.
BubblaV.close()
Closes the chat widget.
BubblaV.toggle()
Toggles the chat widget open or closed.
BubblaV.openSearch()
Opens the search interface (modal).
BubblaV.sendMessage(text)
Sends a message to the chatbot on behalf of the user.
- text (string): The message content to send.
BubblaV.showGreeting(message?)
Shows the greeting message bubble.
Parameters:
message(optional): A custom greeting message to display. If omitted, the default greeting from your settings will be used.
BubblaV.hideGreeting()
Hides the greeting message bubble.
BubblaV.on(event, callback)
Subscribes to an event.
- event (string): The name of the event to listen for.
- callback (function): The function to call when the event occurs.
BubblaV.off(event, callback)
Unsubscribes from an event.
Events
You can listen to these events usingBubblaV.on().
| Event Name | Description | Payload |
|---|---|---|
chat:opened | Triggered when the chat widget is opened. | undefined |
chat:closed | Triggered when the chat widget is closed. | undefined |
search:opened | Triggered when the search interface is opened. | { mode: string } |
search:closed | Triggered when the search interface is closed. | { mode: string } |
message:sent | Triggered when a message is sent by the user. | { conversation_id: string } |
search:query | Triggered when a search query is submitted. | { query: string, source: "input" | "suggestion" } |
ready | Triggered when the widget is fully loaded. | undefined |
