Skip to main content
The BubblaV SDK provides a global 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.
window.BubblaV.open();

BubblaV.close()

Closes the chat widget.
window.BubblaV.close();

BubblaV.toggle()

Toggles the chat widget open or closed.
window.BubblaV.toggle();

BubblaV.openSearch()

Opens the search interface (modal).
window.BubblaV.openSearch();

BubblaV.sendMessage(text)

Sends a message to the chatbot on behalf of the user.
  • text (string): The message content to send.
window.BubblaV.sendMessage("Hello, I need help!");

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.
// Show default greeting
window.BubblaV.showGreeting();

// Show custom greeting
window.BubblaV.showGreeting("Hello! Check out our new features.");

BubblaV.hideGreeting()

Hides the greeting message bubble.
window.BubblaV.hideGreeting();

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.
window.BubblaV.on('chat:opened', () => {
  console.log('Chat widget opened');
});

BubblaV.off(event, callback)

Unsubscribes from an event.
window.BubblaV.off('chat:opened', myCallback);

Events

You can listen to these events using BubblaV.on().
Event NameDescriptionPayload
chat:openedTriggered when the chat widget is opened.undefined
chat:closedTriggered when the chat widget is closed.undefined
search:openedTriggered when the search interface is opened.{ mode: string }
search:closedTriggered when the search interface is closed.{ mode: string }
message:sentTriggered when a message is sent by the user.{ conversation_id: string }
search:queryTriggered when a search query is submitted.{ query: string, source: "input" | "suggestion" }
readyTriggered when the widget is fully loaded.undefined