.addEventListener()

The Mobilisten React-Native SDK provides various events that developers can use to perform customized actions.

Supported events:

EventInvoked when​

EVENT_SUPPORT_OPENED

the user opens the SDK

EVENT_SUPPORT_CLOSED

the user closes the SDK

EVENT_CHATVIEW_OPENED

a chat window is opened

EVENT_CHATVIEW_CLOSED

a chat window is closed

EVENT_CHAT_OPENED

a chat is initiated

EVENT_CHAT_CLOSED

a chat is ended

​​

EVENT_CHAT_MISSED

a chat is missed
EVENT_CHAT_ATTENDEDa chat is picked up
EVENT_CHAT_REOPENEDa chat is reopened
EVENT.CHAT_QUEUE_POSITION_CHANGEDthe position in the queue of a queued chat changes
EVENT_ARTICLE_OPENED (Deprecated) an article is opened
EVENT_ARTICLE_CLOSED (Deprecated) an article is closed
EVENT_ARTICLE_LIKED (Deprecated) an article is liked
EVENT_ARTICLE_DISLIKED (Deprecated) an article is disliked
EVENT_RESOURCE_OPENEDa resource is opened
EVENT_RESOURCE_CLOSEDa resource is closed
EVENT_RESOURCE_LIKEDa resource is liked
EVENT_RESOURCE_DISLIKEDa resource is disliked
EVENT_OPERATORS_ONLINEany of the operators are online.
EVENT_OPERATORS_OFFLINEall the operators are offline.
EVENT_VISITOR_IPBLOCKEDthe visitor's IP is blocked.
EVENT_FEEDBACK_RECEIVEDfeedback is given by the visitor
EVENT_RATING_RECEIVEDa chat is rated by the visitor
EVENT_PERFORM_CHATACTIONa chat action is to be executed. Learn More
EVENT_CUSTOMTRIGGERa custom trigger is executed. Learn More
EVENT_CHAT_UNREAD_COUNT_CHANGEDthe unread count is changed
EVENT_HANDLE_URLa URL in the chat is clicked
EVENT_HANDLE_CUSTOM_LAUNCHER_VISIBILITYShow/hide your custom launcher with the triggered boolean value

 

Example:

CopiedZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_SUPPORT_OPENED, () => 
{
       //your code
});
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_SUPPORT_CLOSED, () => 
{
        //your code
});
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_CHATVIEW_OPENED, (chatID)=> 
{
        //your code
});
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_CHATVIEW_CLOSED, (chatID) => 
{
        //your code
});
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_CHAT_OPENED,(visitorChat) => 
{
       //your code
});
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_CHAT_CLOSED,(visitorChat) => 
{
        //your code
});
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_CHAT_REOPENED, (visitorChat) => 
{
        //your code
});
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT.CHAT_QUEUE_POSITION_CHANGED, (visitorChat) => 
{
        //your code
});
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_CHAT_ATTENDED, (visitorChat) => 
{
        //your code
});
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_CHAT_MISSED, (visitorChat) => {
        //your code
});

// Deprecated, use EVENT_RESOURCE_OPENED instead
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_ARTICLE_OPENED, (articleID) => 
{
        //your code
});
// Deprecated, use EVENT_RESOURCE_CLOSED instead
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_ARTICLE_CLOSED, (articleID) => 
{
        //your code
});
// Deprecated, use EVENT_RESOURCE_LIKED instead
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_ARTICLE_LIKED, (articleID) => 
{
        //your code
});
// Deprecated, use EVENT_RESOURCE_DISLIKED instead
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_ARTICLE_DISLIKED, (articleID) => 
{
        //your code
});

ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_RESOURCE_OPENED, (resource) => 
{
       //your code
});
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_RESOURCE_CLOSED, (resource) => 
{
       //your code
});  
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_RESOURCE_LIKED, (resource) => 
{
       //your code
});
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_RESOURCE_DISLIKED, (resource) => 
{
       //your code      
});

ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_OPERATORS_ONLINE, () => 
{
        //your code
});
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_OPERATORS_OFFLINE, () => 
{
        //your code
});
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_VISITOR_IPBLOCKED, () => 
{
        //your code
});
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_FEEDBACK_RECEIVED, (visitorChat) => 
{
        //your code
});
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_RATING_RECEIVED, (visitorChat) => 
{
        //your code
});
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_CUSTOMTRIGGER, (triggerInformation) => 
{
        //your code
});
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_CHAT_UNREAD_COUNT_CHANGED, (unreadCount) => 
{
        //your code
});
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_HANDLE_URL, (chat) => {
    // chat.url will get the clicked url 
    // chat object has the chat details Eg. chat.question
});
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_HANDLE_CUSTOM_LAUNCHER_VISIBILITY, (visible) => 
{
        //your code
});