.sendEvent()
This API is used to send events to the SDK for several returning callbacks.
Events:
openUrl
This event allows you to open a URL when invoked. When using this event followed by a URL, this will open the mentioned URL.
values: [url]
completeChatAction
This event will complete the chat action as a success or failure with or without a message.
values: [String actionUUID, bool success, String message]
Syntax (openUrl)
CopiedZohoSalesIQ.sendEvent(SIQSendEvent eventName, List<Object> values);
Parameters:
- eventName: the event name of the action to be done.
- Values: It's a dynamic number of parameter values that need to be passed with respect to the event.
Example (openUrl)
CopiedZohoSalesIQ.chatEventChannel.listen((event) {
switch (event["eventName"]) {
case SIQEvent.handleURL:
if (!event["url"].startsWith("https://zylkerhomes.com")) {
ZohoSalesIQ.sendEvent(SIQSendEvent.openUrl, [event["url"]]);
} else {
// Handled by self
}
}
});
The above example code opens the url only when the url doesn't starts with "https://zylkerhomes.com".
Refer - SIQEvent.handleURL in eventChannel() url click callbacks.
Example (completeChatAction)
CopiedZohoSalesIQ.chatEventChannel.listen((event) {
switch (event["eventName"]) {
case SIQEvent.performChatAction:
var actionDetails = event["chatAction"];
ZohoSalesIQ.sendEvent(SIQSendEvent.completeChatAction, [actionDetails["actionUUID"], true, "Chat action has been completed successfully"]);
break;
}
});
Parameters:
- actionuuid - 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() were deprecated.