Skip to main content
You drive the SDK by calling the global window.ObiSDK function with a command name and a payload:
window.ObiSDK(command, payload);
Calls are queued, so it is safe to call commands before the widget finishes loading.

Commands

update

Merge configuration into the widget. Use it to identify the customer, change visibility, move the widget, or open the menu.
window.ObiSDK("update", {
  isActive: true,
  position: "bottom-right",
  showMenu: false,
  user: { id: "user-123", email: "user@example.com" },
});
FieldTypeDescription
isActivebooleanShow or hide the widget.
positionstringbottom-left, bottom, or bottom-right.
showMenubooleanOpen Obi’s menu.
userobjectInformation about the customer. See Identifying users.

startSession

Start a new session for a specific plan.
window.ObiSDK("startSession", {
  planUuid: "<uuid-of-plan-to-start>",
});
FieldTypeDescription
planUuidstringUUID of the plan to start. Required.

stopSession

Stop the current session. Takes no payload.
window.ObiSDK("stopSession");

Configuration object

Set window.obiWidgetConfig before the loader runs to configure the widget at load time. See Widget configuration for all options.
window.obiWidgetConfig = {
  apiKey: "your-api-key",
  position: "bottom-right",
  isActive: true,
};