.sendEvent()
This API is used to send events to the SDK for several returning callbacks.
Events:
OPEN_URL
This event allows you to open a URL when invoked. When using this event followed by a URL, this will open the mentioned URL.
COMPLETE_CHAT_ACTION
This event will complete the chat action as a success or failure, with or without a message.
Syntax (OPEN_URL)
CopiedZohoSalesIQ.sendEvent(ZohoSalesIQ.Event eventName, String url);
Example (OPEN_URL)
CopiedZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT.HANDLE_URL, function(chat) {
if (!chat.url.startsWith("https://zylkerhomes.com")) {
ZohoSalesIQ.sendEvent(ZohoSalesIQ.Event.OPEN_URL, chat.url);
} else {
// Handled by self
}
});
Syntax (COMPLETE_CHAT_ACTION)
CopiedZohoSalesIQ.sendEvent(ZohoSalesIQ.Event eventName, String uuid, boolean success, String message);
Example (COMPLETE_CHAT_ACTION)
CopiedZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT.PERFORM_CHATACTION, function(actionDetails) {
ZohoSalesIQ.sendEvent(ZohoSalesIQ.Event.COMPLETE_CHAT_ACTION, actionDetails.uuid, true, "Chat action has been completed successfully");
});
Parameters:
- uuid - unique Id for the chat action
- success(Optional) - The default value is true
- message(Optional) - The message to be displayed on the chat action button
Refer - Implementation for Chat actions.
Note:completeChatAction() and completeChatActionWithMessage() was deprecated.