Help Docs

Help Docs

  • Docs

›Android

Web

  • Installation
  • Authentication
  • Conversation
  • Conversation Assignment
  • Bot Integration
  • Actionable Message
  • Customization
  • Localization
  • Logout
  • Troubleshooting

Android

  • Installation
  • Authentication
  • Conversation
  • Push Notification
  • Logout
  • Customization

iOS

  • Installation
  • Authentication
  • Conversation
  • Push Notification
  • Customization
  • Logout

Ionic/Cordova/Phonegap

  • Installation
  • Authentication
  • Conversation
  • Push Notification
  • Logout
  • Resolving Errors

Platform APIs

  • Authentication
  • Endpoints

Configration

  • Bot setup
  • Bot Samples
  • Email Fallback
  • Webhooks
  • Access Token URL

Installation

Installing Kommunicate in your Android app is easy and fast. We will walk you through the procedure so you can start answering your support queries within few minutes.

Installation

Add the following in your app build.gradle dependency:

implementation 'io.kommunicate:kommunicate:1.8.1'

Building with proguard

If you are using proguard in your application then add the below rules to your proguard-rules.pro file:

#keep json classes                
-keepclassmembernames class * extends com.applozic.mobicommons.json.JsonMarker {
    !static !transient <fields>;
}

-keepclassmembernames class * extends com.applozic.mobicommons.json.JsonParcelableMarker {
    !static !transient <fields>;
}

#GSON Config          
-keepattributes Signature          
-keep class sun.misc.Unsafe { *; }           
-keep class com.google.gson.examples.android.model.** { *; }            
-keep class org.eclipse.paho.client.mqttv3.logging.JSR47Logger { *; } 
-keep class android.support.** { *; }
-keep interface android.support.** { *; }
-dontwarn android.support.v4.**
-keep public class com.google.android.gms.* { public *; }
-dontwarn com.google.android.gms.**
-keep class com.google.gson.** { *; }

Initialise SDK

After the gradle sync has finished with kommunicate dependency, you can initialise the SDK by calling the below method:

 Kommunicate.init(context, Your APP_ID);

You can get the Application Id by signing up on Kommunicate Dashboard.

Launch chat

Kommunicate provides KMChatBuilder class to create and launch chat directly saving you the extra steps of authentication, creation, initialisation and launch. You can customise the process by building the launchChat object according to your requirements. Below are some examples of how you can customise the builder for launching a single chat:

Parmaters of KMChatBuilder:

ParameterTypeDescription
contextActivityOnly Activity Context is accepted. Excpetion is thrown otherwise
applicationIdStringIgnore if you have already initialised the SDK with Application ID
chatNameStringOptional, you can pass a chat name or null
kmUserKMUserPass the details if you have the user details, null other wise.
withPreChatbooleanPass true if you would like the user to fill the details before starting the chat. IF you have user details then you can pass false.
isSingleChatbooleanPass false if you would like to create new conversation every time user starts a chat. This is true by default which means only one conversation will open for the user every time the user starts a chat.
agentListListPass the list of agents. The agent id would be the email id you used to register on kommunicate. Leave null if you want to create conversation with default agent.
botListListPass the list of bots. Leave null if you haven't integrated any bots
callbackKmCallbackCallback to notify Success or Failure

Launching chat for visitor:

If you would like to launch the chat directly without the visiting user entering any details, then use the builder as below:

       new KmChatBuilder(context).launchChat(new KmCallback() {
                        @Override
                        public void onSuccess(Object message) {
                            Utils.printLog(MainActivity.this, "ChatTest", "Success : " + message);
                        }

                        @Override
                        public void onFailure(Object error) {
                            Utils.printLog(MainActivity.this, "ChatTest", "Failure : " + error);
                        }
                    });

If you have your agentList and bot list then use the builder as below:

List<String> agentList = new ArrayList();
agentList.add("agent1@yourdomain.com"); //add your agentID

List<String> botList = new ArrayList();
botList.add("bot1"); //enter your integrated bot Ids

      new KmChatBuilder(context).setAgentIds(agentList).setBotIds(botList).launchChat(new KmCallback() {
                        @Override
                        public void onSuccess(Object message) {
                            Utils.printLog(MainActivity.this, "ChatTest", "Success : " + message);
                        }

                        @Override
                        public void onFailure(Object error) {
                            Utils.printLog(MainActivity.this, "ChatTest", "Failure : " + error);
                        }
                    });

Launching chat for visitor with lead collection:

If you need the user to fill in details like phone number, emailId and name before starting the support chat then launch the chat with withPreChat flag as true. In this case you wouldn't need to pass the kmUser. A screen would open up for the user asking for details like emailId, phone number and name. Once the user fills the valid details (atleast emailId or phone number is required), the chat would be launched. Use the builder as below:

     new KmChatBuilder(MainActivity.this).setWithPreChat(true).launchChat(new KmCallback() {
                        @Override
                        public void onSuccess(Object message) {
                            Utils.printLog(MainActivity.this, "ChatTest", "Success : " + message);
                        }

                        @Override
                        public void onFailure(Object error) {
                            Utils.printLog(MainActivity.this, "ChatTest", "Failure : " + error);
                        }
                    });

Launching chat with existing user:

If you already have the user details then create a KMUser object using the details and launch the chat. Use the builder as below to create KMUser object with already existing details:

    KMUser user = new KMUser();
    user.setUserId(userId); //Mandatory unique field
    user.setPassword(password)
    user.setImageLink(image-url);

Then pass this user object to the setKmUser method as below:

new KmChatBuilder(MainActivity.this).setKmUser(user).launchChat(new KmCallback() {
                        @Override
                        public void onSuccess(Object message) {
                            Utils.printLog(MainActivity.this, "ChatTest", "Success : " + message);
                        }

                        @Override
                        public void onFailure(Object error) {
                            Utils.printLog(MainActivity.this, "ChatTest", "Failure : " + error);
                        }
                    });

If you have a different use-case and would like to customise the chat creation , user creation and chat launch, you can explore our docs further.

← TroubleshootingAuthentication →
  • Installation
  • Building with proguard
  • Initialise SDK
  • Launch chat
    • Launching chat for visitor:
    • Launching chat for visitor with lead collection:
    • Launching chat with existing user:
Facebook Open Source

Stanford Financial Square,
2600 El Camino Real, Suite 415,
Palo Alto, CA 94306

(+1) (310) 909-7458
hello@kommunicate.io

Docs
WebAndroidiOSIonic/PhonegapXamarin
Product
Pricing and FAQsRequest Demo
Social
FacebookTwitterLinkedin
Copyright © 2019 Kommunicate.io.