start()

Note: This API is supported from version 8.1.0-beta01.

The start() API initiates a call to a specified user using their unique ID anywhere within the application. You can optionally include custom attributes for the call and a callback function to handle the success or failure of the call initiation.

Parameters:

  • id (String) (Optional): The unique ID of the chat to call.
  • displayActiveCall (Boolean): Opens the call screen if there is an ongoing call.
  • attributes (@Nullable SalesIQConversationAttributes) (Optional): Attributes to customize the call, including the user's name, additional info, or display picture metadata.
  • Callback (@Nullable ZohoSalesIQResultCallback<Unit>): A callback function to handle the result of the call initiation. It includes:
    • onSuccess(Unit result): Called when the call is successfully initiated.
    • onFailure(int errorCode, String errorMessage): Called if the call fails to start, providing an error code and a descriptive error message.

      Note: Pass null if you do not require result handling.

Syntax

Copiedvoid start(@Nullable String id, boolean displayActiveCall, @Nullable SalesIQConversationAttributes attributes, @Nullable ZohoSalesIQResultCallback<@Nullable SalesIQConversation> callback);

Example

CopiedSalesIQConversationAttributes attributes = new SalesIQConversationAttributes.Builder()
    .setName("Zylker Homes")
    .setAdditionalInfo("High priority")
    .setDisplayPicture("https://css.zohocdn.com/salesiq/RESOURCE_BUNDLES/embedcw/ASSETS_V6/images/salesiqlogo_leal7QplfZFryJ6FIlVepeu7OftD7mt8q6exU6-34PB8prfIgodN67KcxXM9Y7JQ_.png")
    .build();

ZohoSalesIQCalls.start("custom_chat_id", true, attributes, new ZohoSalesIQResultCallback<Unit>() {
    @Override
    public void onComplete(@NonNull SalesIQResult<SalesIQConversation> result) {
        if (result.isSuccess()) {
            SalesIQConversation conversation = result.getData();
        } else if (result.getError() != null) {
            Log.d("ZohoSalesIQCalls", "Failed to start call error, code: " + result.getError().getCode() + ", message: " + result.getError().getMessage());
        }
    }
});
Copiedval attributes = SalesIQConversationAttributes.Builder()
    .setName("Zylker Homes")
    .setAdditionalInfo("High Priority")
    .setDisplayPicture("https://css.zohocdn.com/salesiq/RESOURCE_BUNDLES/embedcw/ASSETS_V6/images/salesiqlogo_leal7QplfZFryJ6FIlVepeu7OftD7mt8q6exU6-34PB8prfIgodN67KcxXM9Y7JQ_.png")
    .build()

ZohoSalesIQCalls.start("custom_chat_id", true, attributes) { result ->
    if (result.isSuccess) {
        val conversation = result.data
        // Your code here to handle the call started
    } else {
        Log.d("ZohoSalesIQCalls", "Failed to start call error: ${result.error?.code} - ${result.error?.message}")
    }
}