Skip to main content

boot(id, userProperties?, instanceAttributes?)

Make CommandBar available to the user. Before boot is called, CommandBar will not be available, even if the snippet has been run on the page they are on.

boot returns a promise which resolves when it is finished and ready.

Examples

const loggedInUserId = "12345"; // example

// Simple
window.CommandBar.boot(loggedInUserId);

// With user properties
window.CommandBar.boot(loggedInUserId, {
persona: "foo",
});

// With instanceAttributes
window.CommandBar.boot(
loggedInUserId,
{},
{
canOpenEditor: false,
hmac: hmacUserId,
formFactor: {
type: "inline",
rootElement: "commandbar-inline-root",
},
}
);

Method parameters

id Required

string

ID corresponding to the currently logged-in end user. Used to tag analytics events and for end-user personalization (e.g. custom shortcuts, Checklist progress). If you must use anonymous users, pass an empty string.

userProperties

object

Key-value pairs to be associated with the end user for whom CommandBar is being booted. You can filter on these properties from the analytics page in your dashboard. In addition, events passed to a supplied event handler will include metadata you provide via boot.

These properties are stored along with each end-user on the server, and can be used in User property targeting.

instanceAttributes

object

CommandBar options associated with the current session.

PropertyTypeDescription
canOpenEditorbooleanSet to true by default. If set to false, prevents the user from opening the editor via 'open editor'. The editor always requires CommandBar login credentials, so a user opening it is harmless. But if you're worried about users stumbling upon the hidden 'open editor' command and becoming confused, you can set this flag to false at boot time. Note: If you use this flag, make sure to set it to true for internal admins, so they can open the editor!
hmacstringIdentify users with an HMAC of their user ID; this make end user related features, like customizable shortcuts, secure. Learn about identity verification
products('spotlight' | 'checklists' | 'nudges' | 'help_hub')[]A list of products that will be turned on. By default, all CommandBar products will turn on. This can be used to only enable certain features. Products can include 'spotlight', 'checklists', 'nudges' (Product Tours, Announcements, and Surveys), and 'help_hub' (HelpHub and Copilot).
formFactorobjectConfigures the way Spotlight is displayed. An 'inline' formfactor is always visible and hosted within an element on your page. A 'modal' formfactor will display in a modal dialog when open.
copilotAPIHeadersobjectAdditional headers that Copilot will pass to APIs when calling them. This is commonly used to allow Copilot to call authenticated APIs. For example, {'Authorization': 'Bearer 1234'}.

formFactor

object

PropertyTypeDescription
type RequiredstringEither 'modal' (the default) or 'inline'
rootElementElement | stringIf the type is 'inline', then you must specify where Spotlight's text input element will be rendered. Specify either an ID of an element on the page, or an Element (e.g. from document.getElementById)