Chat SDK in a nutshell

This is the developer guide for Chat SDK v1. The new Chat SDK v2 for Android is now available and is the recommended version to integrate Chat into your mobile app.

This guide shows you how to get started as quickly as possible with the Chat SDK for Android. Once up and running, dig into the docs to learn more about the power and flexibility of the Zendesk Chat platform.

For a tutorial on building an Android application that lets users chat with a support agent, see Quick start - Chat SDK for Android.

You can also download our javadocs and the sample project to see how it all works:

Requirements

The SDK supports Android API level 16 (Android 4.1) and up.

Installing the SDK

You can install the Mobile SDK using either the Gradle or Maven dependency management systems.

Gradle

Include the following additions in the appropriate sections in your app in the build.gradle file for the project in which you want to integrate the SDK:

...
// Note that this is root level repositories container and not the one under 'buildScript'
repositories {
    maven { url 'https://zendesk.jfrog.io/zendesk/repo' }
}
...
dependencies {
    implementation group: 'com.zopim.android', name: 'sdk', version: '1.4.8'
}
...
Maven

Make the following additions in the pom.xml file:

...
<repository>
    <id>chatsdk-repo</id>
    <name>Chat SDK Repo</name>
    <url>https://zendesk.jfrog.io/zendesk/repo</url>
</repository>
...
<dependency>
    <groupId>com.zopim.android</groupId>
    <artifactId>sdk</artifactId>
    <version>1.4.6</version>
    <type>aar</type>
</dependency>
...
API-only SDK

If you plan on creating a custom UI when integrating the Chat SDK, you have the option of including an API-only SDK with no UI components. See Chat API.

Configuring the SDK

You need your Zendesk Chat account key to use the SDK. You'll find the key in the Zendesk Chat dashboard. If you don't have access, ask somebody who does to perform the following steps.

  1. In the Chat dashboard, click the triple-dot icon below your profile icon in the upper right, then select Check Connection.

    check connection

  2. Copy and save the account key. It should be the second item in the list.

    account key

Connecting your app to Zendesk Chat

After installing the SDK, initialize it in your application's onCreate() method so that it's executed once only on launch. Initializing with default settings and styling looks as follows:

import com.zopim.android.sdk.api.ZopimChat;
...
ZopimChat.init("your account key");
...

Providing known visitor data

The Chat SDK allows you to provide any of the relevant visitor data to the chat session. Visitor data can be provided at any time and the change will apply to the next chat that is started.

import com.zopim.android.sdk.api.ZopimChat;
import com.zopim.android.sdk.model.VisitorInfo;
...

VisitorInfo visitorData = new VisitorInfo.Builder()
    .name("Visitor name")
    .email("visi[email protected]")
    .phoneNumber("0123456789")
    .build();

ZopimChat.setVisitorInfo(visitorData);

Starting a chat

To start a chat using the default settings when the visitor has activated the relevant control in your app, simply invoke the following:

import com.zopim.android.sdk.prechat.ZopimChatActivity;

...
startActivity(new Intent(context, ZopimChatActivity.class));

The rest of the docs go into greater detail about what you can do with the Chat SDK.