Fetching agent availability programatically
CONTENTS
Overview:
You’re installing Consolto and want to show different views on your website based on agent availability.
You can listen to ongoing events here
However, these are events that are sent in various moments in time. You can create a machine to save their state or simply trigger the following API to get the actual state:
- Set the response listener for the availability data coming from the Consolto widget:
<script>
window.addEventListener('consoltoResponse', function (e) {
console.debug(e.detail); // will return an object with agent ids and their availability state.
});
</script>
- within a script tag dispatch a request to get info as follows, using the 'et-get-info' tag.
<script>
var userDataEvent = new CustomEvent('consolto_h2w', {
detail: {
'et-get-info': true,
},
});
window.dispatchEvent(userDataEvent);
</script
- You're ready to go :)