You can drive the widget from your own UI: show it after login, open its menu from a button, and start or stop specific plans.
Start Obi after login
Most apps should start with the widget hidden and turn it on once the customer is signed in. Enable it and pass their information in the same call:
// In your login handler
function handleLogin(userData) {
// Your existing login logic...
if (window.ObiSDK) {
window.ObiSDK("update", {
isActive: true,
user: {
id: userData.id,
email: userData.email,
firstName: userData.firstName,
lastName: userData.lastName,
company: userData.company,
plan: userData.subscription.plan,
},
});
}
}
We recommend hiding Obi on your login page and only enabling it after authentication.
Show and hide
Toggle the widget at any time:
// Show
window.ObiSDK("update", { isActive: true });
// Hide
window.ObiSDK("update", { isActive: false });
To open Obi’s menu from your own UI element (for example, a “Help” button):
window.ObiSDK("update", { showMenu: true });
Start and stop a session
Start a specific onboarding plan by passing its UUID. This begins a new session for that plan.
// Start the plan with this UUID
window.ObiSDK("startSession", {
planUuid: "<uuid-of-plan-to-start>",
});
// Stop the current session
window.ObiSDK("stopSession");
A plan is a guided flow Obi takes a customer through (sometimes called a course). Get plan UUIDs from Cor Admin. See Core concepts.