Smart Bot Snippet
Integration
The installation of the Smart Bot solution on the customer's site is done by integrating a snippet of javascript code within the desired page.
JS
Integrate the Javascript snippet just before closing the </body>
tag. The Smart Tribune script must be loaded as far downstream as possible in the script loading chain in order to avoid possible conflicts with the scripts present on the client page.
<script type="text/javascript">
window.addEventListener('STBOTLoaded', function (e) {
e.detail.init({
kbId: 0,
locale: 'en',
cookieOptin: false,
relativeRestPath: 'xxx',
});
});
</script>
<script
type="text/javascript"
async
src="https://assets.app.smart-tribune.com/smart-tribune/BOT/bot.main.js"
></script>
The integration of the code snippet above is sufficient to allow the partial display of the BOT within the page. You must also communicate your domain name to your Smart Tribune contact point so that we allow the product to be displayed completely on your environment.
Please note, the link to bot.main.js
is a demonstration of the product, the smart-tribune
folder in the url will be replaced by the one that will be communicated to you. The url changes completely during the transition from pre-production (public) to production. The complete url is communicated by your Smart Tribune contact point in charge of your account.
The domains calling on the specified knowledge base must be declared beforehand directly in the knowledge base configuration in Smart Dashboard by your Account Manager.
Validation environment
This url differs depending on the environment on which the solution is to be installed at the customer site. It is customary to use PUBLIC for pre-production and to use PRODUCTION for production at the customer site. All this information is communicated by Smart Tribune after the development phase.
PRODUCTION script
<script
type="text/javascript"
async
src="https://assets.app.smart-tribune.com/smart-tribune/BOT/bot.main.js"
></script>
PRE-PRODUCTION script
<script
type="text/javascript"
async
src="https://assets.app.smart-tribune.com/smart-tribune/BOT/public/bot.main.js"
></script>
Variables list
Variable | Type | Condition | Example | Description |
---|---|---|---|---|
kbId | int | required | kbId : 0 | Variable specific to each customer, it corresponds to the identifier (system identifier) of the knowledge base to be used. This is available in Smart Dashboard, the content administration interface. You can find your kbId on the Dashboard home page in the "Select a knowledge base" then "system identifier" box. |
locale | string | required | locale : "en" | It allows the customer to specify in which language the solution should be displayed. This only applies to multilingual knowledge bases. |
cookieOptin | bool | required | cookieOptin : false | It allows you to prevent or not the activation of the analytics cookie (possible value: true or false). By disabling this functionality, it will no longer be possible to send information in the analytics provider for your FAQ. The default value is false. |
relativeRestPath | string | required | relativeRestPath: "path/xx/..." | This configuration variable allows you to specify the path to connect the bot. It will be given by the Account Manager in charge of your project. |
The optional functions
Use the show()
function
The show()
function will allow you to open the box.
From a... | Description |
---|---|
button | Just call the show() function on your button. |
<button onclick="detail.show()">Btn</button>
From a... | Description |
---|---|
timer | Place a setTimeout in a <script> tag after initializing Smart Bot. |
<script type="text/javascript">
window.addEventListener('STBotLoaded', function (e) {
var stBot = e.detail;
stBot.init({
kbId: 0,
locale: 'en',
cookieOptin: false,
relativeRestPath: 'xxx',
});
setTimeout(() => {
stBot.show();
}, 3000);
});
</script>
<script
type="text/javascript"
async
src="https://assets.app.smart-tribune.com/smart-tribune/BOT/bot.main.js"
></script>
From a... | Description |
---|---|
scroll | Place a headset after initializing Smart Bot. |
<script type="text/javascript">
window.addEventListener('STBotLoaded', function (e) {
var stBot = e.detail;
stBot.init({
kbId: 0,
locale: 'en',
cookieOptin: false,
relativeRestPath: 'xxx',
});
window.addEventListener(
'scroll',
function (e) {
stBot.show();
},
false,
);
});
</script>
<script
type="text/javascript"
async
src="https://assets.app.smart-tribune.com/smart-tribune/BOT/bot.main.js"
></script>
If you need to use these functions outside the script (on a button by example), you will need to store stBot
inside window
which is a global variable :
<script type="text/javascript">
window.addEventListener('STBOTLoaded', function (e) {
window.stBot = e.detail;
window.stBot.init({
kbId: 0,
locale: 'en',
cookieOptin: false,
relativeRestPath: 'xxx',
});
});
</script>
<script
type="text/javascript"
async
src="https://assets.app.smart-tribune.com/smart-tribune/BOT/bot.main.js"
></script>
Use the hide()
function
The hide()
function will allow you to close the box.
From a... | Description |
---|---|
button | Just call the hide() function on your button. |
<button onclick="window.stBot.hide()">Btn</button>
Use the off()
function
The off()
function will allow you to make the box disappear from the page.
From a... | Description |
---|---|
button | Just call the off() function on your button. |
<button onclick="window.stBot.off()">Btn</button>
Use the on()
function
The on()
function will allow you to make the box appear on the page.
From a... | Description |
---|---|
bouton | Just call the on() function on your button. |
<button onclick="window.stBot.on()">Btn</button>