Messenger

Messenger class encapsulates all the network requests and parsing logic involved in the messenger relevant Help Center API Endpoints. Use this class to access Conversation Starter, Conversations, Messages and Satisfaction Ratings.

The Messenger class needs to be instantiated with the Help Center Url (String) and optionally a Fingerprint-ID (FingerprintAuth).

If the Fingerprint Id is not specified, the Messenger class will automatically generate one for you.

import com.kayako.sdk.messenger.Messenger;

//...
Messenger mMessenger = new Messenger(HELP_CENTER_URL);

If an existing Fingerprint Id is used, then you will have access to all of the previous conversations.

import com.kayako.sdk.messenger.Messenger;

//...
String fingerprintId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; // UUID v4
FingerprintAuth fingerprintAuth = new FingerprintAuth(fingerprintId);

Messenger mMessenger = new Messenger(HELP_CENTER_URL, fingerprintAuth);

Sample Code Snippets:

List<Conversation> conversations = mMessenger.getConversationList(0, 20); 
import com.kayako.sdk.base.callback.ListCallback;

//...
mMessenger.getConversationList(0, 20, new ListCallback<Conversation>() {
    @Override
    public void onSuccess(List<Conversation> items) {
        // use conversations
    }

    @Override
    public void onFailure(KayakoException exception) {
        // show error message
    }
});
import com.kayako.sdk.base.callback.ItemCallback;

//...
mMessenger.getConversation(1234L, new ItemCallback<Conversation>() {
    @Override
    public void onSuccess(Conversation item) {
        // Use conversation
    }

    @Override
    public void onFailure(KayakoException exception) {
        // show error message
    }});
import com.kayako.sdk.base.callback.ItemCallback;

//...
mMessenger.putMessage(
    1234L, 5678L, 
    new PutMessageBodyParams(
        PutMessageBodyParams.MessageStatus.DELIVERED),
    new EmptyCallback() {
        @Override
        public void onSuccess() {
            // Perform task
        }

        @Override
        public void onFailure(KayakoException exception) {
            // show error message
        }
});


Method Summary

Method Description
getConversationStarter Retrieve Conversation Starter information
getConversationList Retrieve list of Conversations
getConversation Retrieve a specific Conversation
postConversation Create a new Conversation
getMessages Retrieve list of Messages
getMessage Retrieve a specific message
postMessage Add a message to a conversation
getRatingList Retrieve satisfaction ratings added to a conversation
postRating Add a rating to a conversation
putRating Update an existing rating added to a conversation

getConversationStarter

Name Type Description
Callback ItemCallback (Optional) Provide for asynchronous requests

Retrieve conversation starter information like recently active agents and average response time.


getConversationList

Name Type Description
offset int Number of items to skip - use for pagination
limit int Number of items returned in one request
Callback ListCallback (Optional) Provide for asynchronous requests

Retrieve list of Conversation resources.


getConversation

Name Type Description
offset int Number of items to skip - use for pagination
limit int Number of items returned in one request
Callback ItemCallback (Optional) Provide for asynchronous requests

Retrieve list of Category resources.


postConversation

Name Type Description
params PostConversationBodyParams Encapsulation of the necessary body parameters
Callback ItemCallback (Optional) Provide for asynchronous requests

Create a new conversation.


getMessages

Name Type Description
conversationId long id of conversation whose messages you wish to retrieve
offset int Number of items to skip - use for pagination
limit int Number of items returned in one request
Callback ListCallback (Optional) Provide for asynchronous requests

Retrieve list of Message resources.


getMessage

Name Type Description
conversationId long id of conversation whose messages you wish to retrieve
messageId long id of message you wish to retrieve
offset int Number of items to skip - use for pagination
limit int Number of items returned in one request
Callback ItemCallback (Optional) Provide for asynchronous requests

Retrieve list of Message resources.


postMessage

Name Type Description
conversationId long id of conversation whose messages you wish to retrieve
messageId long id of message you wish to retrieve
params PostMessageBodyParams Encapsulation of the necessary body parameters
Callback ItemCallback (Optional) Provide for asynchronous requests

Add a new message to an existing conversation.


putMessage

Name Type Description
conversationId long id of conversation whose messages you wish to retrieve
messageId long id of message you wish to retrieve
params PutMessageBodyParams Encapsulation of the necessary body parameters
Callback EmptyCallback (Optional) Provide for asynchronous requests

Update the status of a message, such as marking a message as SEEN or DELIVERED.


getRatingList

Name Type Description
conversationId long id of conversation whose ratings you wish to retrieve
Callback ListCallback (Optional) Provide for asynchronous requests

Retrieve the list of satisfaction ratings added for a conversation.


postRating

Name Type Description
conversationId long id of a conversation for which a rating is to be added
params PostRatingBodyParams Encapsulation of the necessary body parameters
Callback ItemCallback (Optional) Provide for asynchronous requests

Add a rating for a conversation.


putRating

Name Type Description
conversationId long id of a conversation for which a rating is to be added
ratingId long id of the rating to be updated
params PutRatingBodyParams Encapsulation of the necessary body parameters
Callback ItemCallback (Optional) Provide for asynchronous requests

Update an existing rating of a conversation.