Integration Guide

This SDK contains wrapper code used to call the Kayako APIs from Java applications.

For Android-specific code and samples, see the SDK for Android

Prerequisites

The following steps assume you are using the Gradle build system.

Getting Started

In order to use the code in this SDK, you need to add the following to your module's build.gradle file.

//...
dependencies {
    compile 'com.squareup.okhttp3:okhttp:3.4.1'
    compile 'com.squareup.okio:okio:1.9.0'
    compile 'com.google.code.gson:gson:2.4'
    compile 'org.threeten:threetenbp:1.3.3' // added in v1.0.0
    compile 'com.kayako:kayako:1.0.+'
}

Usage

Supported resources

The following lists all the supported resources and how to use them.

Name Description
HelpCenter The Help Center class allows you to access the Help Center APIs relevant to the Knowledgebase.
Messenger The Messenger class allows you to access the Help Center APIs relevant to the Messenger.

Types of loading

There are two ways to load a resource:

  1. Synchronous: The synchronous methods are those methods that do not take a callback as an argument and are meant to be run on the same thread calling the method.

    import com.kayako.sdk.helpcenter.category.Category;
    
    //...
    List<Category> categories = mHelpCenter.getCategories(0, 10); 
    
  2. Asynchronous: The asynchronous methods are those methods that run on a separate thread. They take a callback as an argument that is called when the request completes.

    There are further two types of callbacks used in Asynchronous methods.

    1. ListCallback
    2. ItemCallback


    import com.kayako.sdk.helpcenter.category.Category;
    import com.kayako.sdk.helpcenter.base.ListCallback; // added in v1.0.0
    import com.kayako.sdk.base.callback.ItemCallback; // added in v1.0.0
    //...
    
    // Use ListCallback
    mHelpCenter.getCategories(0, 10, new ListCallback<Category>() {
        @Override
        public void onSuccess(List<Category> items) {
            // use categories
        }
    
        @Override
        public void onFailure(KayakoException exception) {
            // show error message
        }
    });
    
    // Use ItemCallback
    mHelpCenter.getCategory(1234L, new ItemCallback<Category>() {
        @Override
        public void onSuccess(Category item) {
            // use category
        }
    
        @Override
        public void onFailure(KayakoException exception) {
            // show error message
        }
    });
    

Source Code & Licensing

The source code is available on the following github repository:

https://github.com/kayako/Kayako-Java-SDK

The source code is distributed under the Apache 2.0 License:

https://www.apache.org/licenses/LICENSE-2.0