Spark and Widget Integration
Load Spark from the CDN and configure the Widget.
Spark is delivered as an ES module from the Chatbyte CDN and initializes the Widget. This is the recommended integration path for almost every app.
CDN embed
<script type="module">
import { createWidget } from 'https://cdn.chatbyte.ai/spark.min.js';
const widget = await createWidget('your-agent-id', {
apiOrigin: 'https://app.chatbyte.ai',
});
widget.open();
</script>Options
interface CreateWidgetOptions {
theme?: 'light' | 'dark' | 'auto';
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
primaryColor?: string;
assistantName?: string;
apiOrigin?: string;
initialToken?: string;
}
interface WidgetNotificationOptions {
id?: string;
text: string;
openOnClick?: boolean;
oncePerSession?: boolean;
}Notes
apiOrigindefaults tohttps://app.chatbyte.ai.initialTokenis optional and can pre-identify a user.theme: 'auto'follows system preferences.- Automatic launcher prompts are configured in Chatbyte settings. For page-specific prompts, call
widget.showNotification(options).
For detailed JavaScript examples, see the Widget Integration (JavaScript) guide.