.shouldOpenUrl()

This API is used to set the URL click behavior in the chat. If this value is passed as true, clicking on a URL will redirect to the specific URL. Else action block inside the SIQEvent.handleUrl event listener will be followed while clicking an URL link.

 

.shouldOpenUrl()

CopiedZohoSalesIQ.shouldOpenUrl(bool open);

Example

CopiedZohoSalesIQ.shouldOpenUrl(true);
ZohoSalesIQ.chatEventChannel.listen((event) {
    switch (event["eventName"]) {
        case SIQEvent.handleURL:
            val chat = event["chat"];
            print(event["url"] + "is clicked. Chat Id: " + chat["id"]);
        break;
    }
});

The above code opens the url directly from the SDK and also the action block will be executed on clicking the URL.

CopiedZohoSalesIQ.shouldOpenUrl(false);
ZohoSalesIQ.chatEventChannel.listen((event) {
    switch (event["eventName"]) {
        case SIQEvent.handleURL:
            val chat = event["chat"];
            print(event["url"] + " is clicked. Chat Id: " + chat["id"]);
        break;
    }
});

If shouldOpenUrl is false, only the action block in SIQEvent.handleURL event listener will be executed on clicking the URL, and the URL will not be opened until the sendEvent(SIQSentEvent.openUrl, []) is used. 

Note: Please check the ZohoSalesIQ.sendEvent() API to open the URL by default when the shouldOpenUrl is false.