.shouldOpenUrl()
This API is used to handle URL-related actions inside Mobilisten.
By default, clicking on a URL will redirect to the specific URL. But if you want further control over the URL, like sending a notification after the visitor clicks on the URL or performing any custom actions, you can use this API.
To handle the URL behavior, the value inside the shouldOpenUrl() API must be false. i.e., ZohoSalesIQ.Chat.shouldOpenUrl(false), then the default action will not be executed. Now you can use the API ZohoSalesIQ.sendEvent( ZohoSalesIQ.Event.OPEN_URL, url) to open the URL.
Note: Only when shouldOpenUrl is false, the action block in ZohoSalesIQ.EVENT_HANDLE_URL event listener will be executed on clicking the URL.
Syntax
CopiedZohoSalesIQ.Chat.shouldOpenUrl(open: boolean);
Example
The below snippet opens the URL directly from the SDK and also the action block will be executed on clicking the URL.
CopiedZohoSalesIQ.Chat.shouldOpenUrl(true);
ZohoSalesIQ.addEventListener(ZohoSalesIQ.EVENT_HANDLE_URL, (chat) => {
console.log(chat.url);
});