ChipBot loads asynchronously and waits for the entire page to load before we load our dependencies within the browser. Because of this, it can be tricky to use the Web APIs if ChipBot isn’t available yet.
To ensure you only interact with the Web APIs when ChipBot is ready, wrap all your code in the following implementation:
window.asyncChipBotApi = window.asyncChipBotApi || [];
window.asyncChipBotApi.push(['onReady', () => {
// execute code when ChipBot is loaded
}]);
If you’re on our white label program, you can leverage the non-branded API namespace. It has all the same methods as the branded ones.
Async: customerBotApiAsync
Non-Async: customerBotApi
window.customerBotApiAsync = window.customerBotApiAsync || [];
window.customerBotApiAsync.push(['onReady', () => {
// execute code when white label bot is loaded
}]);
This will hide the icon of ChipBot.
chipBotApi.hide();
This will show the icon of ChipBot.
chipBotApi.show();
chipBotApi.renderBaseIcon(document.querySelector('div'));
chipBotApi.getProductInfo();
chipBotApi.getSessionInfo();
chipBotApi.setSessionIdentity({name: '', email: ''});
chipBotApi.eventManager.on('reporting.all', e => console.log(e));