KnowledgeBase.addListener()
The ZohoSalesIQ.KnowledgeBase.addListener API provides resource event callbacks, allowing you to monitor various visitor actions related to the resources. These actions includes opening, closing, liking and disliking a resource.
Events | Invoked when |
RESOURCE_OPENED | a resource is opened |
RESOURCE_CLOSED | a resource is closed |
RESOURCE_LIKED | a resource is liked |
RESOURCE_DISLIKED | a resource is disliked |
Example
Copied const { Event } = ZohoSalesIQ.KnowledgeBase;
ZohoSalesIQ.KnowledgeBase.addListener(({event, body}) => {
switch (event) {
case Event.RESOURCE_OPENED:
console.log(body.resource, 'EVENT_RESOURCE_OPENED');
console.log(body.type, 'EVENT_RESOURCE_OPENED');
break;
case Event.RESOURCE_CLOSED:
console.log(body.resource, 'EVENT_RESOURCE_CLOSED');
console.log(body.type, 'EVENT_RESOURCE_CLOSED');
break;
case Event.RESOURCE_LIKED:
console.log(body.resource, 'EVENT_RESOURCE_LIKED');
console.log(body.type, 'EVENT_RESOURCE_LIKED');
break;
case Event.RESOURCE_DISLIKED:
console.log(body.resource, 'EVENT_RESOURCE_DISLIKED');
console.log(body.type, 'EVENT_RESOURCE_DISLIKED');
break;
default:
break;
}
});