These methods can be used anywhere on the web and called as a javascript function.
You can edit existing variables at the beginning of a Webchat conversation.
Within the code snippet used to integrate webchat into your site, you can set variables with external information.
A new object must be added to contain the variables with the values to be edited. The object is BOTMAKER_VAR.
<script>
/* Aquí deben ser definidas todas las variables- */
var BOTMAKER_VAR = {
firstName: 'newValueForFirstName',
lastName: 'newValueForLastName',
customVar: 'newValueForCustomVar'
};
(function () {
let js = document.createElement('script');
js.type = 'text/javascript';
js.async = 1;
js.src = 'https://go.botmaker.com/rest/webchat/p/XXXXX/init.js';
document.body.appendChild(js);
})();
</script>
You can edit your own variables, such as firstName and lastName, or new variables. The only condition is that these variables already exist in the bot.
If you want to keep or use a unique ID or one from your system associated with the chat, you can send that data in the userIdOnBusiness variable inside BOTMAKER_VAR
<script>
/* Aquí deben ser definidas todas las variables */
var BOTMAKER_VAR = {
userIdOnBusiness: 'myBusinessId',
...otherVariables
};
(function () {
let js = document.createElement('script');
js.type = 'text/javascript';
js.async = 1;
js.src = 'https://go.botmaker.com/rest/webchat/p/XXXXX/init.js';
document.body.appendChild(js);
})();
</script>
To integrate webchat on your mobile, you can choose to:
- Embed the webchat in a **webview**. The same script is used as for the web. For a better mobile experience, it is recommended to use the methods described in the webchat.
Ej:
![](https://storage.googleapis.com/m-infra.appspot.com/public/res/SoporteBotmaker/20220322-SvahnYKi5mNUcM3FPWR2itGvP9h2-ZDOBA-.png)
- Integrate it into your own mobile app chat by integrating and processing incoming and outgoing messages through the Botmaker API.