.addListener()
The Mobilisten React Native SDK provides an interface for various chat event callbacks to help developers track different actions related to chat like open, close performed by the app user. It invokes callback methods for various chat actions performed by the visitors. You need to follow the steps below to implement the chat event handler:
| Method | Description |
chatViewOpen() | Invoked when the user opens the chat window. This API returns the ID of the chat that has been opened. |
chatViewClose() | Invoked when the user closes the chat window. This API returns the ID of the chat that has been closed. |
chatOpen() | Invoked when the chat started by user. This API returns the chat(of type VisitorChat) opened. |
chatClosed() | Invoked when the chat gets ended. This API returns the chat(of type VisitorChat) closed. |
chatAttended() | Invoked when the chat is reopened. This API returns the chat(of type VisitorChat) reopened. |
chatMissed() | Invoked when the chat is attended. This API returns the chat(of type VisitorChat) attended. |
chatReOpened() | Invoked when the chat is missed. This API returns the chat(of type VisitorChat) missed. |
Syntax:
CopiedZohoSalesIQ.addEventListener(eventName, (callback) =>
{
//your code
});Example
chatviewOpen()
CopiedZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_CHATVIEW_ OPENED =>
{
//your code
});chatviewClose()
CopiedZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_CHATVIEW_CLOSED =>
{
//your code
});chatOpen()
CopiedZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_CHAT_OPENED,(visitorChat) =>
{
//your code
});chatClose()
CopiedZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_CHAT_CLOSED,(visitorChat) =>
{
//your code
});
chatReopen()
CopiedZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_CHAT_REOPENED, (visitorChat) =>
{
//your code
});chatAttended()
CopiedZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_CHAT_ATTENDED, (visitorChat) =>
{
//your code
});chatMissed()
CopiedZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_CHAT_ MISSED, (visitorChat) =>
{
//your code
});