Here is the script model we use, with the variables that can be customized, and their explanations below.
<script>
window.botmindWidget = null;
function initBotmindChat() {
if (window.botmindWidget.works && window.botmindWidget.init) {
window.botmindWidget.init({
token: '[token]',
host: 'https://api.widget.botmind.ai',
language: '[language]',
},
[user-data],
[display-options]
);
}
}
function BCinitialize(i, t) { var n; i.getElementById(t) ? initBotmindChat() : ((n = i.createElement("script")).id = t, n.async = !0, n.src = 'https://widget.botmind.io' + "/public/widget.js", n.onload = initBotmindChat, i.head.appendChild(n)) } function BCinitiateCall() { BCinitialize(document, "botmind-webchat-js") } if (document.readyState === 'loading') { window.addEventListener ? window.addEventListener("load", BCinitiateCall, !1) : window.attachEvent("load", BCinitiateCall, !1) } else { BCinitiateCall() };
</script>
Explanation of the customizable variables:
[token]: This is your Botmind token, which will be provided to you when the project starts.
[host]: This is the URL of the Botmind server, and the URL to use is: https://api.widget.botmind.io
[language]: This represents the widget language using the standard two-character ISO language code (for example: 'fr' for French, 'en' for English, or 'es' for Spanish). By changing the widget's language, it is possible to modify the title, subtitle, and welcome buttons in different languages.
[user-data]: This represents user data. It can be left as undefined
if the user is not logged in, or you can use the JSON object below:
{
email: 'email@email.com',
firstName: 'First Name',
lastName: 'Last Name',
customData: [
{ key: 'custom_data_1', value: 'value_1' },
{ key: 'custom_data_2', value: 'value_2' }
]
}
You'll notice the fields email
, firstName
, and lastName
correspond to the user's email address, first name, and last name, respectively. A custom data array can also be added to store information specific to your business (such as customer status, date of last order, etc.) that will be transmitted in the client's context and can be used within Botmind.
[display-options]: This represents the display options for the widget, which can be adjusted for each page where the script is triggered. It can be left empty or undefined
, or you can use the JSON object below:
{
startWithWidgetOpen: false,
setWidgetOnLeftSide: false,
}
Both options can take the values true
or false
, with the default values being false
. The option startWithWidgetOpen
allows the widget to be displayed open when the page is loaded.
The option setWidgetOnLeftSide
allows the widget to be displayed on the left side of the screen (by default, it is positioned on the right side).
Commentaires
0 commentaire
Vous devez vous connecter pour laisser un commentaire.