Installation
Choose the integration method that fits your application.You’ll need your Application ID from the Moss Dashboard. You’ll also need a JWT signing key — see Authentication.
NPM Package (React)
For React 17+ applications.Install
Basic Setup
AddAgentProvider and AssistantButton to your app. The provider does not need to wrap your entire application — just the Moss components.
App.tsx
Peer Dependencies
The SDK requires React 17 or 18 as a peer dependency:CDN Script Tag
For any web application, regardless of framework.Basic Setup
Add the script tag to your HTML. The SDK auto-initializes and renders the assistant button.Configuration via JavaScript
For more control, configure viawindow.mossSettings before the script loads:
Global API
After initialization, a globalwindow.MossSDK object is available:
Custom Triggers
Open the assistant from any element using thedata-moss-trigger attribute — no hooks required.
Examples
React Component
Without AssistantButton
You can use custom triggers instead of the built-in button:TypeScript Constant
The SDK exports the attribute name for programmatic use:Framework Examples
- Next.js (App Router)
- Next.js (Script Tag)
- Vue.js
- Angular
app/layout.tsx
Next Steps
Authentication
Set up JWT token authentication
Configuration
Configure SDK behavior and options