Send Parameters from MindBehind Webchat to the Bot

Prev Next

This guide explains how to send parameters from MindBehind Webchat to the bot. You can find the following details in this guide:

Default data

The default data is always sent to the bot. MindBehind always sends the following parameters:
    • BROWSER_TYPE: The type of browser the client has (For example: Microsoft Edge, Mozilla Firefox, Google Chrome)
    • CHAT_URL: The URL of the page

Parameters in the URL

 The URL (query string) is checked for any parameters that start with 'MB_'. If found, these parameters are sent as uppercase letters with the connect message. For example, “https://app.mindbehind.com/chatbot-test?channelId={channelId}&MB_CLIENT_NAME=clientName”.

Parameters in the window object of the page

The window object is checked for parameters that start with 'MB_'. If found, these parameters are sent in uppercase with the connect message. For example, window.MB_CLIENT_NAME=clientName

Hide the widget

First, it should be checked that the Windows object contains the mbHideIcon parameter. This parameter is a boolean. If window.mbHideIcon = true, the icon will be hidden on that webpage. For example, to create a function in JavaScript for Web Messenger 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.

Use mbShowOnclick

This feature is a function that triggers the widget pop-up. If it is set to true or false, the widget animation will be automatically activated. 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 with mbShowOnclick function on the window object. window.mbShowOnclick(<boolean>);