Lifecycle Methods Covered
init()
boot()
shutdown()
setUserProperties()
1. init()
Used only with the NPM package. Initializes the SDK with your license key and optional configuration (like CSP settings).
NPM Package:
Optional config:
**Important **- You must call init() before using boot() or any other method.
2. boot()
Starts the Copilot for a logged-in user. This is what makes the agent visible and interactive.
Script/CDN:
NPM Package:
userId
– required (string): unique ID for the current useruserProperties
– optional: user-level data (name, plan, etc.)instanceAttributes
– optional: product config, API URLs, and auth headers
3. shutdown()
Hides the Copilot from view. Usually called when the user logs out or switches accounts.
Script/CDN:
NPM Package:
Best practice: always call shutdown() before calling boot() again for a different user.
4. setUserProperties()
Updates user properties after boot()—useful for real-time changes like plan upgrades or preference updates.
Script/CDN:
NPM Package:
Summary Table
Method | Purpose | When to Use |
---|---|---|
init() | Initialize the SDK (NPM only) | On page load |
boot() | Show the agent to the current user | After user login |
shutdown() | Hide the agent | On user logout or session end |
setUserProperties() | Update user data for the current session | When user attributes change in real time |