bridgeapp-ai-chat-widget
v0.1.6
Published
Embeddable chat widget for communication with Bridge AI agent
Readme
Bridge AI Chat Widget
Embeddable AI chat widget for web applications.
Installation
npm install bridge-ai-chat-widgetUsage
import { ChatWidgetInstance } from "bridge-ai-chat-widget";
const widget = new ChatWidgetInstance({
mountElementId: "chat-widget-root",
agentId: "222d810a-92dd-4bb4-9ce6-1fee92238e7f",
customerInteractionSession: {
accessToken: "ACCESS_TOKEN",
chatId: "CHAT_ID",
expiresAt: new Date(Date.now() + 86400000).toISOString(),
},
assetsUrl: "https://metamediastatic.com",
wsUrl: "wss://ws.brid93.com/ws",
apiUrl: "https://api.brid93.com",
AIAvatar: true,
background: false,
voiceEnabled: true,
footer: false,
manualOpen: false
});
widget.addEventListener("avatar_ready", () => {
widget.setOpen(true)
});
//this event is thrown either when session is already expired or about to be expired
widget.addEventListener("renew_session", () => {
const session = //... aquire session
widget.setCustomerInteractionSession(session)
});widget.destroy()