Login Contact Us Usecases

Chat SDK

Deliver uninterrupted customer chat experiences on web and mobile applications with just a few lines of code. Kapture Chat’s Android and IOS SDK can be easily integrated with your mobile apps, helping your support team drive better engagement and customer support.

SDK for Android

Purpose

This helps in integrating our chat to your existing app which can create tickets and enquries in real-time.

Below are some screenshots that showcase the configuration set up for Ticketing:

Android SDK API 1

Auto reply messages set up for sending the welcome message, closing message and when assignment of users exceeds the maximum limit.

Android SDK API 2

We can also schedule the working hours for the chat assignment as below:

Android SDK API 3

Offline ticket assignment helps in choosing a queue to map the tickets which are created during non-working hours.

Android SDK API 4

Email alert option helps in getting an email when a chat is created.

Android SDK API 5

Once the above details are filled, you can save the configuration and then proceed with the scripts to update in the mobile app.

For integration please follow the steps below:

Step 1 : Download the SDK

Click on download button to download the android SDK. DOWNLOAD

Once downloaded you will find the below Android SDK along with the installation guide in the zip folder.

Minimum supported SDK version:

Kapchat Android SDK requires minimum API level to be 15.

Steps for Kapchat Android SDK Integration:

Step 1 :

Import KapchatSDK.aar to your project

  • From File menu, select Project Structure and click on Add Module (+ button on top left corner). File -> Project Structure -> Add Module
  • Select Import .jar/.aar Package.
  • Locate KapchatSDK.aar and click Finish

Step 2 :

Add the following dependencies to your build.gradle file inside the dependencies section.

Implementation 'com.android.support:appcompat-v7:26.1.0'
Implementation 'com.android.support:recyclerview-v7:26.1.0'
Implementation 'com.google.code.gson:gson:2.8.0'
Implementation  project (':kapchatSDK')

Make sure that all the dependencies are added.

Step 3 :

Add the following provider to your manifest.xml

   <provider
         android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.provider"
         android:exported="false"
         android:grantUriPermissions="true">
         <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/providerpath" />
   </provider>

Step 4 :

To initialise Kapchat

  • Use KapchatHelper.startChatScreen(Context);

    Kapchat uniquely identifies each registered app with a combination of 3 tokens:

  • Customer Code – A unique code to identify the customer currently logged in the App
  • Support Key – A unique key for your app. This key will be used by the SDK and is specific to your app
  • Encryption Key – A secret key that will also be shared to you when integrating the SDK. This key should not be exposed and is specific to the SDK integrated with your app

Example Code

   import com.adjetter.kapchatsdk.KapchatHelper;
   import com.adjetter.kapchatsdk.interfaces.CallBackResponse;
   ...
   ...
   KapchatHelper.initialise(MainActivity.this, "12345", "12345abcdef", "abcdefghijklmnop ", new CallBackResponse() {
   @Override
   public void intialiseResponse(String responseStatus) {
   // Success response status if all the parameters are valid
   }
   });
   ...

Step 5 :

To start Kapchat chat screen:

  • Use KapchatHelper.startChatScreen(Context);

    To start Kapchat chat screen with template:

  • Use KapchatHelper.startChatScreenWithTemplate(Context,KapchatTemplateMessage);

Example Code

import com.adjetter.kapchatsdk.KapchatHelper;
...
...
KapchatHelper.startChatScreen(MainActivity.this);
KapchatTemplateMessage templateMessage = new KapchatTemplateMessage();
templateMessage.setMessage("Hi! I have a query for order #1234");
KapchatHelper.startChatScreen(MainActivity.this,templateMessage );
...

Signing out of Kapchat

To sign out of Kapchat:

  • Use KapchatHelper.logoutKapchat(Context);

Example Code

   import com.adjetter.kapchatsdk.KapchatHelper;
   ...
   ...
   KapchatHelper.logoutKapchat(MainActivity.this);
   ...

Kapchat UI Customisation

To make the Kapchat android SDK look like your app, please follow the steps given below:

  • Define your custom Kapchat theme in your styles.xml and inherit it from KapchatTheme.
  • Create a style named KapchatTheme.Base and set its parent to your custom Kapchat theme.

For Example

You can give the mlook and feel of your app to Kapchat SDK by customizing very few attributes as follows:

                            <style name="MyCustomKapchatTheme" parent="KapchatTheme">
                            <item name="colorAccent">@color/colorAccent</item>
                            <item name="colorPrimary">@color/bbcolorprimay</item>
                            <item name="colorPrimaryDark">@color/bbcolorprimarydark</item>
                            </style>
                            <style name="KapchatTheme.Base" parent="MyCustomKapchatTheme"></style>
                         

You can customize Android's styleable attributes along with Kapchat styleable attributes.

You can find the list of styleable attributes below:

Kapchat styleable attributes

Field Resource Type Summary
colorPrimary Color The primary branding color for the app.
colorPrimaryDark Color Dark variant of the primary branding color.
colorAccent Color Bright complement to the primary branding color.
kc_toolbartitlename String Color of the Toolbar title string.
android:textColorSecondary Color Color of the icon in Toolbar (navigation and overflow icon)
kc_toolbartitlesize Dimension Size of the Toolbar title string
kc_attach_gallery_icon Drawable Reference for the gallery attachment icon (available in toolbar)
kc_attach_camera_icon Drawable Reference for the camera attachment icon (available in toolbar)
kc_activity_background Color/Drawable Reference for background of activity
kc_chatlist_bottomlayout_divider Color Divider for message list and message input layout (In Kapchat color is transparent so it is not visible)
kc_typemessage_et_background Color/Drawable Background for the message input layout (Edit text)
kc_typemessage_et_minlines Integer Minimum no of line shown in message input layout (Edittext)
kc_typemessage_et_maxlines Integer Maximum no of line shown in message input layout (Edittext)
kc_typemessage_et_text_size Integer Text size for string in message input layout
kc_typemessage_et_hint String Hint as string to display in message input layout
kc_typemessage_et_hint_color Color Color for hint in message input layout
kc_typemessage_et_text_color Color Text color for string in message input layout
kc_message_send_button Drawable Reference for send button to send a message
kc_message_send_btn_padding_left Dimension Left space between text and border in message input layout
kc_message_send_btn_padding_right Dimension Right space between text and border in message input layout
kc_message_send_btn_margin_left Dimension Space between text input layout and send button
kc_message_send_btn_margin_right Dimension Space to right of send button
kc_user_chat_background Color/Drawable Background for user messages
kc_user_chat_textcolor Color Color for user messages
kc_user_chat_time_textcolor Color Color for string - time of message which is send from user
kc_agent_chat_background Color/Drawable Background for agent messages
kc_agent_chat_textcolor Color Color for agent messages
kc_agent_chat_time_textcolor Color Color for string - time of message which is received from agent
kc_date_layout Drawable Background of date layout (common for both user and agent )
kc_date_textcolor Color Text color for string in date layout
kc_attachment_download_icon Drawable Resource icon for download button (Appear when user receive attachments or message is carbon of attachments)
kc_attachment_retry_background Color Background for retry button it appears if attachments failed to upload
kc_attachment_retry_textcolor Color Text color for string in retry button
kc_attachment_delete_icon Drawable Resource icon for delete icon (Available in top bar of attachment screen)
kc_message_status_send_icon Drawable Resource icon for message send (In kapchat it is tick mark)
kc_message_status_offline_icon Drawable Resource icon for message failed to send
kc_message_status_cancel_icon Drawable Resource icon for cancel message

For Example

You can give the mlook and feel of your app to Kapchat SDK by customizing very few attributes as follows:

                              <style name="MyCustomKapchatTheme" parent="KapchatTheme">
                              <item name="android:textColorSecondary">@color/black</item>
                              <item name="kc_toolbartitlecolor">@color/black</item>
                              <item name="kc_toolbartitlesize">@dimen/titlesize</item>
                              <item name="kc_attach_gallery_icon">@drawable/gallery_icon</item>
                              <item name="kc_attach_camera_icon">@drawable/kapchatcapture</item>
                              <item name="kc_activity_background">@color/white</item>
                              <item name="kc_chatlist_bottomlayout_divider">@color/secondarytext</item>


                              <item name="kc_typemessage_et_hint_color">@color/border</item>
                              <item name="kc_typemessage_et_text_color">@color/black</item>
                              <item name="kc_message_send_button">@drawable/sendbbicon</item>
                              <item name="kc_message_send_btn_padding_left"> @dimen/message_send_btn_paddingleft</item>
                              <item name="kc_message_send_btn_padding_right"> @dimen/message_send_btn_paddingright </item>
                              <item name="kc_message_send_btn_margin_left">@dimen/message_send_btn_marginleft</item>
                              <item name="kc_message_send_btn_margin_right"> @dimen/message_send_btn_marginright</item>
                              <item name="kc_user_chat_background">@drawable/user_background</item>
                              <item name="kc_user_chat_textcolor">@color/black</item>
                              <item name="kc_user_chat_time_textcolor">@color/border</item>
                              <item name="kc_agent_chat_background">@drawable/agent_background</item>
                              <item name="kc_agent_chat_textcolor">@color/black</item>
                              <item name="kc_agent_chat_time_textcolor">@color/border</item>
                              <item name="kc_date_layout">@drawable/agent_background</item>
                              <item name="kc_date_textcolor">@color/bbcolorprimay</item>
                              <item name="kc_attachment_download_icon">@drawable/kapchatdownloadicon</item>
                              <item name="kc_attachment_retry_background">@color/colorAccent</item>
                              <item name="kc_attachment_retry_textcolor">@color/kapchatwhite</item>
                              <item name="kc_attachment_delete_icon">@drawable/delete</item>
                              <item name="kc_message_status_send_icon">@drawable/done</item>
                              <item name="kc_message_status_offline_icon">@drawable/offlinemsg</item>
                              <item name="kc_message_status_cancel_icon">@drawable/cancel</item>

                              </style>
                              <style name="KapchatTheme.Base" parent="MyCustomKapchatTheme"></style>
                         

*Make sure you have created style KapchatTheme.Base and its parent as your custom Kapchat theme.

Start using Kapchat SDK

Kapchat SDK is now integrated in your app and it will be ready to provide customer support service via chat.

Step 2 : Initialization

You will need to pass the three parameters from your main app:

  • Customercode - The customer code of the customer using the app.
  • Partner support key: 7ed069019aea4625d57f955fbe507024891ff4e50946990630

This is your partner support key.

Encryption key: qFctsh8hQor448qM

This is your encryption key which will be used by the SDK.

You can then start the chat by calling the initialization code with the above parameters as follows:

                              KapchatHelper.initialise(MainActivity.this, "123456" /*replace with actual customer code*/, "7ed069019aea4625d57f955fbe507024891ff4e50946990630", "qFctsh8hQor448qM", new CallBackResponse() {
                                 @Override
                                 public void intialiseResponse(Boolean responseStatus) {
                                    // Success response status if all the parameters are valid
                                 }
                              });
                         

To start Kapchat chat screen:

                              Use KapchatHelper.startChatScreen(Context);
                              ...
                              import com.adjetter.kapchatsdk.KapchatHelper;
                              ...
                         

To start Chat Activity in Kapchat:

KapchatHelper.startChatScreen(MainActivity.this);

SDK for IOS

Chat integration using customer login with iOS:

For integrating our chat to your existing app, please follow the steps below:

Step 1 : Download the SDK

Click on download button to download the iOS SDK. DOWNLOAD
You will find the iOS SDK along with installation guide in the zip folder.

Please go through the installation guide for a detailed explanation on using the SDK.

Step 1 :

Add the framework & bundle to the application project.

Step 2 :

  • Go to Project settings
  • Go to your apps main target -> General -> Embedded libraries
  • Click on + Button and add Framework & Bundle

Step 3 :

Add the following pods:

  • XMPPFramework
  • FMDBMigrationManager
  • AWS Framework

Why do we need to add the pods?

Your code in this custom framework can import classes from other frameworks normally, but it is just a reference, classes from another framework will not be compiled at this time. So you must import the referenced framework on the new project as well.

POD Creation

1) Open the terminal application and create a pod file inside the project directory

2) And add the following lines inside the pod file.

# Uncomment the next line to define a global platform for your project
# platform :ios, ‘8.0’

target 'KapChat' do platform :ios, '8.0' use_frameworks!
pod 'XMPPFramework', '~> 3.7.0' pod 'FMDB'
source 'https://github.com/CocoaPods/Specs.git' use_frameworks!
pod 'AWSS3'
end
post_install do |installer_representation|
installer_representation.pods_project.targets.each do |target|
target.build_configurations.each do |config| config.build_settings['ONLY_ACTIVE_ARCH'] ='NO'
end

Install the pods to your project

Step 4

                              #import <KapChat/KapChat.h> Appdelegate.h
                              To initiate the setup to the server
                              [[XMPPSetup sharedInstance] initialSetup];
                           

Step 5

   import “ViewController.h”
   #import
   <KapChat/KapChat.h>

Write the following line to send a request to the server.

   [[ChatHandlerVC sharedInstance] sendChatRequestToserver: CustomerCode supportKey:supportKey encryptionKey:chatKey withCompletion:^(ChatMessageVC *vc, BOOL success) {
   [vc isChatHeaderShown:YES];
   }];

ChatKey[1]: A secret key that will be used for encrypting the customer code.

CustomerCode: is the code that is used to identify the customer in the Kapture CRM

SupportKey[1]: A unique key that will be used to access the server for the support service.

Here self.navigationController is used to navigate framework screens.

Step 6

  • Go to Project settings
  • Go to your apps main target -> Build Phases -> Link Binary with Libraries
  • Click on + Button

Add the following frameworks to your project

1) CFNetwork.framework

2) Security.framework

3) libresolv.ltd

4) systemConfiguration.framework

Note: These frameworks are required for using the XMPPFramework

Step 7

Add this following lines to info.plist

1) To enable HTTP URL with App transport security enabled in iOS 9

   <key>NSAppTransportSecurity</key>
   <dict>
   <key>NSExceptionDomains</key>
   <dict>
   <key>testdomain.com</key>
   <dict>
   <key>NSIncludesSubdomains</key>
   <true/>
   <key>NSExceptionAllowsInsecureHTTPLoads</key>
   <true/>
   <key>NSExceptionRequiresForwardSecrecy</key>
   <true/>
   <key>NSExceptionMinimumTLSVersion</key>
   <string>TLSv1.2</string>
   <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
   <false/>
   <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
   <true/>
   <key>NSThirdPartyExceptionMinimumTLSVersion</key>
   <string>TLSv1.2</string>
   <key>NSRequiresCertificateTransparency</key>
   <false/>
   </dict>
   </dict>
   </dict>

2) Enable security access to camera in iOS 10

                                 Key    : Privacy - Camera Usage Description
                                 Value : $(PRODUCT_NAME) camera use
                           

3) Enable security access to Photo Library in iOS 10

      Key    : Privacy - Photo Library Usage Description Value : $(PRODUCT_NAME) photo use

[1] Appendix:

The chatKey (encryption key) and supportKey are confidential and can be accessed in the CRM

You can find these keys in the configuration page

Go to Chat -> Chat Configuration

Select Chat for tickets -> iOS SDK

Step 2: Initialization

You will need three parameters for initializing the app:

  • Customercode - The customer code of the customer using the app.
  • Partner support key:
    7ed069019aea4625d57f955fbe507024891ff4e50946990630
    This is your partner support key.
  • Chat key:
    qFctsh8hQor448qM
    This is your encryption key which will be used by the SDK.

Step 3:

   Appdelegate.h
   #import <KapChat/KapChat.h>

   Initiate the chat using the following code:
   [[XMPPSetup sharedInstance] initialSetup];

Step 3:

   import "ViewController.h"
   #import <KapChat/KapChat.h>

Initialize the app using the following code:

   [[ChatHandlerVC sharedInstance] sendChatRequestToserver:@"123456" /*replace with actual customer code*/ supportKey:@"7ed069019aea4625d57f955fbe507024891ff4e50946990630" chatKey:@"qFctsh8hQor448qM" withCompletion:^(ChatMessageVC *vc, BOOL success) {
   [vc isChatHeaderShown:YES];
   }];