Default data (always sent to the bot)
We are always sending the
1. BROWSER_TYPE : The type of browser the client has (ex: Microsoft Edge, Mozilla Firefox, Google Chrome)
2. CHAT_URL: The url of the page
Parameters in the URL
We are checking the url (query string) if it contains any parameters that starts with “MB_”. We are sending that parameter as capital letters with the connect message.
Ex: “https://app.mindbehind.com/chatbot-test?channelId={channelId}&MB_CLIENT_NAME=clientName”
Parameters in the window object of the page
We are checking the window object if it contains any parameters that starts with “MB_”. We are sending that parameter as capital letters with the connect message.
Ex: window.MB_CLIENT_NAME=clientName
First, it should be checked that the windows object contains mbHideIcon parameter. This parameter is boolean. If window.mbHideIcon = true, then the icon will be hidden in that webpage.
For example, to create a function in javascript for webmessenger display:
const createScript = (hideShow) => { window.mbHideIcon = hideShow const script2 = document.createElement("script"); script.src = {{WEBCHAT_URL}} script.async = true; document.body. replaceChild(script1,script2); }
Similar to this example, functions should be triggered in every other change.
Using mbShowOnclick
This feature is a function that triggers the widget popup. if set to true or false, widget animation will be activated automatically. true is used to open the widget and false is used to close it. It works as an event. In other words, you do not need to reload the script sent to you every time. This trigger can be used by using the mbShowOnclick function on the window object. window.mbShowOnclick(<boolean>);