Chat Actions
SalesIQActionListener can be used to acknowledge the success or failure of callback methods to the SDK. Follow the specified steps below to implement the listener:
Step 1:
Copiedpublic class MySalesIQActionListener implements SalesIQActionListener {
@Override
public void handleCustomAction(SalesIQCustomAction customAction, SalesIQCustomActionListener listener) {
//your code goes here
//example actions
if (paymentCompleted) {
listener.onSuccess("payment success!");
} else {
listener.onFailure("payment failed");
}
}
Parameters:
customAction:
It can be used to identify the element from which the action is performed. (elementID, name, label, clientActionName)
elementID | Id of an element. Value specified with the key "id" in elements tag will be returned |
name | Value specified with the key "name" inside actions will be returned |
label | Value specified with the key "label" inside actions will be returned |
clientActionName | Value specified with the key "clientaction_name" inside actions will be returned |
listener:
It can be used to invoke the callback to SDK end. (Until the callback is received, the loader will be shown for the default timeout of 30 seconds. The timeout can be changed using the API provided)
Example:
- listener.onSuccess()
- listener.onFailure()
- listener.onSuccess("success message")
- listener.onFailure("failure message")
Step 2:
CopiedZohoSalesIQ.ChatActions.setListener(new MySalesIQActionListener());
Note: Using this API after a successful callback from init() is optional.