The first thing you need to do is adding the SDK in your project.

Alli SDK requires Android 4.4 (API level 19) or above.

Step 1. Download and import the SDK

  1. Download the SDK here.
  2. In Android Studio, go to File > New > New Module and import Alli SDK into your project:
  3. Add allisdk as a dependency in File > Project Structure > Dependencies.

Step 2. Add Alli SDK as dependency

Go to the build.gradle file for your app module and add Alli SDK as a dependency:

  dependencies {
    implementation project(":allisdk")

Step 3. Add app permissions

Add the following to the AndroidManifest.xml:

    <uses-permission android:name="android.permission.INTERNET"/>

Step 4. Configure Java 8 language feature

Make sure your Android plugin is 3.0.0 or higher and configure it as the following in the corresponding build.gradle file:

  android {
    // Configure only for each module that uses Java 8
    // language features (either in its source code or
    // through dependencies).
    compileOptions {
      sourceCompatibility JavaVersion.VERSION_1_8
      targetCompatibility JavaVersion.VERSION_1_8

Steps 5. Initialize Alli SDK

  1. Make sure the Alli SDK are imported in your main file:
  import ai.allganize.allisdk.Alli;
  import ai.allganize.allisdk.AlliErrorCode;
  import ai.allganize.allisdk.AlliEventHandler;
  1. Initialize the Alli library with your API Key by adding the following in onCreate() method in your application's first Activity class:
  protected void onCreate(Bundle savedInstanceState) {
    // new Alli(String apiKey, WebView webView, AlliEventHandler eventHandler, boolean showHeader, boolean showFooter, boolean showBackButton)
    // showHeader - optional, default: true, If you want to remove the header, turn off this option.
    // showFooter - optional, default: true, If you want to remove the footer, turn off this option.
    // showBackButton - optional, default: true, If you want to remove the back button on the header, turn off this option.
    alli = new Alli("YOUR_API_KEY", webView, this, true, true, false);

You can find your API Key by selecting “Settings” from the left navigation:

Step 6. Create chat window

To create the chat window and start a conversation with your customer, make the following call:


If you want to specify the User ID and the Placement, use the format below.

// user id: "USER-123"
// placement: "LANDING"
alli.event("USER-123", "LANDING", context);

For users logged into your app and you know who they are, you can tell Alli who they are using the user id. You can also set a temporary id for users who are not logged in.

Placement is a place and point in time in your app where you might want to display a skill flow to your users. Once you have created a Placement, you can change the skill flow at that Placement with the Alli Dashboard. You can think of an Alli Placement as a billboard, and an Alli skill as what gets shown on that billboard. The power of the Placement system is that you can decide what campaign to show at a placement whenever you like.

You should implement the Alli chat window in the parent view controller and assign the parent view controller as the delegate property. It is vitally important that the ViewController passed to this call be the top-most view and that it be unobstructed by other views.

Parent view should have a minimum height and width.

Step 7: Delegate methods to handle Alli events

The following delegate methods will provide feedback on the chat conversation status:

  public protocol AlliEventHandler {
    // Called when initialized successfully. 
    // You may receive NOT_INITIALIZE_YET error if 
    // called before this event.
    void onInitialized(WebView view);

    // Called when chat started successfully.
    void onConversationStarted(WebView view, String userId, String placement, Object context);

    // Called when conversation did not start 
    // even when Alli.event was called.
    void onConversationNotStarted(_ view: WKWebView!, userId: String, placement: String, context: Any?)

    // Called when user has closed the chat 
    // window or Alli.close() is called.
    void onConversationClosed(WebView view, String userId, String placement, Objective context)

    void onError(WebView view, AlliErrorCode errorCode, String userId, String placement, Object context)

Use this format to add links to other applications. Below is an example to link to the Google Map.

    public boolean handleUrlLoading(String url) {
        Uri gmmIntentUri = Uri.parse("geo:37.4919653,127.0330243");
        Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
        return true;