<script type="module">import Chatbox from 'https://cdn.mu.chat/embeds/dist/chatbox/index.js?v=2';Chatbox.initBubble({//set the idagentId: 'YOUR_AGENT_ID',// If provided will create a contact for the user and link it to the conversationcontact: {firstName: 'John',lastName: 'Doe',email: 'customer@email.com',phoneNumber: '+33612345644',userId: '42424242',},// Provided context will be appended to the Agent system promptcontext: "The user you are talking to is John. Start by Greeting him by his name.",// Your interface configurationinterface: { primaryColor: '#145dee', // Initial messages can be personalized with the contact's name initialMessages: ["hello John","how are you"]},initConfig: { primaryColor: '#145dee',},// Optional: Loading strategyloadStrategy: "FAST", // Options: 'FAST' | 'SEO_FRIENDLY' | 'COMPLETE_LOAD'// Optional: Callback functionsonMarkedAsResolved: () => { // Handle conversation resolution},onAgentLoaded: (agent) => { // Handle when agent loaded event},});</script>
Fired when all website resources (including images, scripts, stylesheets, and other assets) have completely finished loading. This event ensures that every component of your webpage has been successfully downloaded and rendered.
provide a function to be called when the event is triggered
Show events
muchat_ready : when the widget is ready
muchat_open : when the widget is opened only for bubble widget
muchat_close : when the widget is closed only for bubble widget
muchat_sendMessage : when the user sends a message
muchat_createNewConversation : when the user creates a new conversation
muchat_markedResolved : when the user marks the conversation as resolved
On event
Copy
const widget = await Chatbox.initBubble({agentId: 'YOUR_AGENT_ID',})window.Muchat.on('muchat_ready', () => {//do something when the widget is ready});window.Muchat.on('muchat_sendMessage', ({ message }) => {// do something when the user sends a message// also you can get the message});window.Muchat.on('muchat_open', () => {// do something when the widget is opened});window.Muchat.on('muchat_close', () => {// do something when the widget is closed});window.Muchat.on('muchat_createNewConversation', () => {// do something when the user creates a new conversation});window.Muchat.on('muchat_markedResolved', () => {// do something when the conversation is marked as resolved});// other events are similar<ParamField path="off"><ToDoDoc /></ParamField><ParamField path="setStyle"><ToDoDoc /></ParamField>