JS SDK methods

Open, show or hide Chat Widget, updateUser details and more usefull stuff
Written by Alexander Shpilka
Updated 1 year ago

Ribbo AI widget provides you with small JavaScript API on your website. With it you can control and customize your chat and widget behavior.

openChat

Call this method to expand/open chat widget

window.Ribbo.openChat();

hideWidget

Call this method if you want to hide chat widget button on specific webpages

window.Ribbo.hideWidget();

displayWidget

Invoke this method to show the chat widget button again after you have hidden it.

window.Ribbo.displayWidget();

updateUser

To enhance the functionality of Ribbo, you can provide additional user information. This information will be visible in the chat history tab, which can be useful for reference. Additionally, you have the option to share these details with the AI model, which can help in providing more personalized and context-aware interactions.

To share user details with Ribbo, you must pass an object containing key-value pairs.
The keys should represent the field names, and the values should be the corresponding user details.
You can use custom field names that are relevant to your application.

Ensure that the values you provide are in the text format and have max length of 70 characters.

Here is an example of how to invoke this method with user details:

window.Ribbo.updateUser({
  "name": "Alexander",
  "plan": "Enterprise",
  "paymentOverdue": "true"
});

When you use the updateUser method to provide user details to Ribbo, the information is stored in the local storage of the user's browser. This means that once the details are submitted, they will be retained and automatically utilized in subsequent interactions with the chat widget.

Did this answer your question?