Skip to main content
If you would like to see any of the Roadmap features, something else or have feedback on the existing API, reach out to liam@botbrains.io.
The Web SDK allows you to control the launcher bubble from the global JavaScript object $botbrains. The SDK ships by default and we will expand the API based on user needs. See Roadmap. Chat launcher bubble in the bottom-right corner of a website

Prerequisite

The SDK is NOT supported if you use the deprecated iFrame integration. Use the launcher and benefit from all new features.
The SDK will assume you run the code via the launcher integration.

Use Cases

Hide Launcher on specific pages

Hide Launcher on small devices

Integrated Product Help - Buttons

Annotate User Data

Identify Users

We also support identifying users against our system. Please talk to liam@botbrains.io for get an introduction.

Change the suggestions

Docs

You can then use the $botbrains object via .push immediately below adding our script. .push allows you to call .do .set .on and .off without errors. If you need .is or .on, store a callback in window.BOTBRAINS_ON_LOADED.
  • .is to branch your code based on our state
  • .do to trigger actions, don’t return values
  • .set to modify state, annotate users and more
  • .on and .off for registering/unregistering callbacks
  • .get returns a Promise
On a page that has botBrains loaded, you can open the Developer Console and use $botbrains.help() to see all command names.

Commands

do-Commands are by default async and don’t return anything. This allows you to call them at any point, even before the SDK is ready.
Expanded chat widget showing conversation messages and input box

Conditionals

Personalization - Theme and Localization

By default, we will automatch user preferences and choose the most fitting value. You can manually control them.

Events

Currently supported events are:
  • chat.ready
  • frame.loaded
  • chat.opened
  • chat.closed
  • message.sent

message.sent

Fires whenever the user sends a message. Use it to track conversations in your own analytics or trigger actions on your page.

Users

Data

You can annotate user data and additional arbitrary JSON under external_attributes up to 8 KB.

Identify

You can also identify users, which enables cross device session continuity by setting an external_id. Be careful, you may only set external_id once. Two users with the same external_id will be able to read messages of the other user. Please check your implementation by reading our Complete Guide to Users or talking to ben@botbrains.io.

Debugging

If you have issues, enable verbose logs with window.BOTBRAINS_DEBUG = true or ?botbrainsDebug=true in the URL.

Roadmap

There are many ways we could expand the API to control more parts of the Chat.
  • Support Attachments
Missing something? Let us know what you would like to see, support@botbrains.io.

Frequently Asked Questions

Coming soon.