How to Send parameters from Mindbehind WebChat to the bot

How to Send parameters from Mindbehind WebChat to the bot

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

Hiding the Widget

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>);


    • Related Articles

    • Reserved Bot runtime parameters

      PARAMETER ACTION DESCRIPTION INPUT_TYPE Input Action After an input action our system stores the input type inside this parameter,  you can use it inside logic action if you want to do different actions according to user input. The input types can be ...
    • How to Use Bot Action

      Action usage Bot action is used to forward the message to sub bot to achieve re-usability and to build up simple and clear bots. You will need to drag and drop it to your assistant canvas (or simply click on it from actions menu): Then you will need ...
    • How to assign Key-Value to Client from Mindbehind Live and APIs

      Website (live.mindbehind.com) If the agent has an open live conversation from the right client panel the agent can add, remove a key-value propery of the client by selecting the Profile tab Using Apis: Get Client: Endpoint URL: ...
    • How to use Web Messenger in Native Apps

      ·       All native apps need to use WebView to open a web page that contains the script of the channel. ·       The web page can be done by the customer side by calling the script provided in the channel settings. You can find details in this ...
    • How to Use Wait for Action

      Action usage Use the wait for action when you want to control the assistant behavior from your outside system. The story begins by drag and dropping (Or simply clicking on) the Wait for action from the Actions menu on the left side of your assistant ...