Android SDK V7
# Android SDK V7
The Sobot SDK Visitor Side provides enterprises with a comprehensive intelligent customer service solution. The Sobot Customer Service SDK includes both customer service business logic and interactive interfaces. Enterprises only need two simple steps to integrate Sobot customer service into their APP, enabling the APP to offer 24/7 customer service capabilities.
The administrator can add an APP in the background under "Homepage - Online Customer Service - Settings - Channel Integration Settings - Add Channel", and then complete the SDK integration according to the instructions in this access document.
Sobot Customer Service SDK has the following features:
- Online consultation: Chatbot, Live agent, Leave a message, Help center.
- Assign to specific skill groups.
- Guide users to leave a message when queuing or agents are offline.
- Hide the "Transfer to agent" button in bot-first mode, show it after N unknown bot responses.
- Customer satisfaction survey: User-initiated + Prompt upon exit.
- Pass user data: User ID + Basic info + Custom fields.
- Pass product source page: Page title + Page URL.
- Highly customizable UI.

Relevant restrictions and precautions:
The Android SDK supports Android system version 5.0 (API 21) and above, and works in both portrait and landscape modes.
It is recommended to upgrade the development tool Android Studio to version 3.0 or above.
The Android SDK needs to request dangerous permissions for storage, microphone, and camera. Otherwise, some functions cannot be used.
# Document Introduction
# ● Integration Process Diagram

# ● File Description
SDK files include SDK source code package (sobotsdk_x) , Demo source code (Sobot_Sdk_Demo_Android_V6) , and Doc related documentation.
| File | Description |
|---|---|
| ZCSobotApi | This file provides access functions |
| Information | Startup configuration information parameter class |
# Integration Method
# ● Import Integration
Download link: Android_SDK_V6 (opens new window)
Import Module:
Unzip the downloaded Sobot Android_SDK_XXX.zip file, copy the chatsdk file directly into your project, then Build --> Clean Project. After that, add the project dependency in build.gradle.
After completing the steps above, the build.gradle file looks as follows:
dependencies {
implementation project(':chatsdk')
implementation 'com.squareup.okhttp3:okhttp:4.4.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
//Currently supports several common image loading libraries. You must choose one from the following and add the dependency.
//implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
//implementation 'com.squareup.picasso:picasso:2.71828'
//implementation 'com.facebook.fresco:fresco:2.6.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
}
2
3
4
5
6
7
8
9
10
11
【Notice】
If you are using the picasso framework, starting from version 4.1.4, the SDK supports version 2.71828 and above by default.
If you are using the Glide v4 framework, starting from version 4.1.4, the SDK supports version 4.9.0 and above by default.
If you are using an SDK version earlier than 4.1.4, but glide v4 is using a version above 4.9.0, you also need to add the dependency separately: 'com.sobot.chat:sobotsupport-glidev4:2.3'.
If you want to use your own image loading method, you can use the following approach: SobotBitmapUtil.setImageLoader(new SobotImageLoader() {}); After using this method, network images will not use the image loading method inside the SDK when displayed.
# ● Dependency Integration
Latest version address (opens new window)
implementation 'com.sobot.chat:chatsdk:+'
In build.gradle, as follows:
dependencies {
implementation 'com.sobot.chat:chatsdk:+'
implementation 'com.squareup.okhttp3:okhttp:4.4.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
//Currently supports several common image loading libraries. You must choose one from the following image loading libraries to add dependency.
//implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
//implementation 'com.squareup.picasso:picasso:2.71828'
//implementation 'com.facebook.fresco:fresco:2.6.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
}
2
3
4
5
6
7
8
9
10
11
【Notice】
If you are using the Picasso framework, starting from version 4.1.4, the SDK supports version 2.71828 and above by default.
If you are using the Glide v4 framework, starting from version 4.1.4, the SDK supports version 4.9.0 and above by default.
If you are using an SDK version earlier than 4.1.4, but glide v4 is using a version above 4.9.0, you still need to add the dependency separately: 'com.sobot.chat:sobotsupport-glidev4:2.3'.
If you want to use your own image loading method, you can use the following approach: SobotBitmapUtil.setImageLoader(new SobotImageLoader() {}); After using this method, network images will not use the image loading method inside the SDK when displayed.
Confusion related:
Refer to the obfuscation configuration in the obfuscation file (Android_SDK_x.x.x\Sobot_Sdk_Demo_Android_V6\sobotsdkdemo\proguard-rules.pro) to add obfuscation rules.
#Sobot SDK
-keep class com.sobot.chat.** {*;}
-dontwarn com.sobot.chat.**
2
3
Note: The image framework used needs to be configured for obfuscation by yourself.
# Quick Start
# ● Domain Settings
Domain Name Description:
- The default SaaS platform domain name is: https://api.sobot.com.
- If you are using Tencent Cloud services, set it to: https://www.soboten.com.
- If you are using a local deployment, use your own service domain name.
Example code:
[Note: The domain name must be set before all interface requests, that is, it must be set before initialization.]
SobotBaseUrl.setApi_Host("Domain");
# ● Get Appkey
Log in to the Sobot Management Platform (opens new window) to retrieve, as shown in the image.

# ● Initialization
Initialization parameters and calling method:
[Note: Before starting the Sobot SDK, you need to call the initialization method initSobotSDK. Otherwise, the SDK will not start.]
[Note: The call of other functions in ZCSobotApi needs to be done after the initialization method is completed, otherwise it will not take effect.]
Interface:
/**
* Initialize sdk
* @param applicationcontext Context Required
* @param appkey User's appkey Required. If you are a platform user, pass the headquarter's appkey.
* @param partnerid User's unique identifier. Do not pass the same value. It can be empty.
*/
ZCSobotApi.initSobotSDK(Context application,String appkey,final String partnerid);
2
3
4
5
6
7
Example code:
private void initSobotApp() {
ZCSobotApi.initSobotSDK(your application,"your appkey", "");
}
2
3
# ● Launch Sobot Page
# 1. Launch the Sobot Page
Interface
Information info = new Information();
//appkey is required
info.setApp_key("Your appkey");
/**
* @param context Context object
* @param information Initialization parameters
*/
ZCSobotApi.openZCChat(context, information);
2
3
4
5
6
7
8
Example code:
Information info = new Information();
// appkey is required
info.setApp_key(et_appkey.getText().toString());
// Note: User unique identifier. Do not pass the same value. Optional, maximum length is 300.
info.setPartnerid("");
// User nickname. Optional.
info.setUser_nick("");
// User name. Optional.
info.setUser_name("");
// User phone. Optional.
info.setUser_tels("");
// User email. Optional.
info.setUser_emails("");
// Custom avatar. Optional.
info.setFace("");
// User QQ. Optional.
info.setQq("");
// User remark. Optional.
info.setRemark("");
// Landing page title. Optional.
info.setVisit_title("");
// Landing page URL. Optional.
info.setVisit_url("");
// Company name. Added in version 4.1.5.
info.setEnterprise_name("xxx");
ZCSobotApi.openZCChat(context, info);
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
If you have special requirements, the SDK also provides a way to integrate the conversation interface by embedding it as a Fragment. This allows developers to use the SDK more flexibly. See the example code below (you can also refer to the implementation of Fragment in SobotChatActivity).
Bundle informationBundle = new Bundle();
informationBundle.putSerializable(ZhiChiConstant.SOBOT_BUNDLE_INFO, info);
SobotChatFragment fragment = SobotChatFragment.newInstance(informationBundle);
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction transaction = fm.beginTransaction();
// containerId is the resId of the ViewGroup
transaction.replace(containerId, fragment);
try {
transaction.commitAllowingStateLoss();
} catch (Exception e) {
}
2
3
4
5
6
7
8
9
10
11
# 2. Start the Customer Service Center
Information info = new Information();
info.setApp_key("Your AppKey"); //The secret key assigned to the App
//Customer service center phone button, both phone number and display text must not be empty to show
info.setHelpCenterTel("18510000000");//Phone number
info.setHelpCenterTelTitle("Contact Number");//Display text for the call button
/**
* @param context Context object
* @param information Initialization parameters
*/
ZCSobotApi.openZCServiceCenter(context, information);
2
3
4
5
6
7
8
9
10
11
12
The effect picture is as follows:

# ● End Session
When users log out of the app, they can call the SDK's logout operation (used when switching accounts). This operation will notify the server to unbind the push notifications, preventing the situation where push messages are still sent to the current device after the user has logged out.
When the user logs out, call the following method:
[Note: Calling this method will cause the channel connection to break. At this time, the user will no longer be able to receive messages.]
/**
* @param context Context object
*/
ZCSobotApi.outCurrentUserZCLibInfo(context);
2
3
4
# Function Description
# ●Permission Description
The SDK uses 3 high-sensitivity permissions (file storage, microphone, camera).
Permission Usage Statement:
| Permission | Functions involving this permission |
|---|---|
| File Storage | Click on pictures, videos inside the plus sign; Upload pictures, videos in messages; |
| Microphone | Send voice messages to customer service; Shoot inside the plus sign; |
| Camera | Shoot inside the plus sign; Take photos in messages; |
- These high-sensitivity permissions are only used in the functions listed in the table above. They are dynamically checked and requested during use, and can only proceed after user consent. The absence of these high-sensitivity permissions does not affect the normal use of other SDK functions.
# ● Robot Customer Service
# 1. Custom Access Mode
Based on the needs of your own business, you can configure the following initialization parameters to control the access mode:
// Whether to use voice function true for use, false for not use. Default is true.
info.setUseVoice(true);
// Whether to use robot voice function true for use, false for not use. Default is false. Requires payment to use.
info.setUseRobotVoice(false);
// Customer service mode control -1 no control, runs according to the mode set in the server backend.
// 1 Only robot 2 Only human 3 Robot priority 4 Human priority
info.setService_mode(-1);
2
3
4
5
6
7
# 2. Custom Transfer to Human Event
The SDK can configure a human-transfer interceptor to perform additional logic processing before transferring to a human agent, such as customizing the skill group selection dialog.
- Set up the interceptor
SobotOption.transferOperatorInterceptor = new SobotTransferOperatorInterceptor() {
@Override
public void onTransferStart(final Context context, final SobotTransferOperatorParam param) {
//do something
}
};
2
3
4
5
6
- Modify the transfer-to-human parameters SobotTransferOperatorParam. The following are the introductions of modifiable parameters:
// Skill group ID
String groupId;
// Skill group name
String groupName;
// Whether to show tips after transferring to human agent
boolean isShowTips;
// Product card information
ConsultingContent consultingContent;
2
3
4
5
6
7
8
- Use the manual transfer parameter to actively call the manual transfer interface:
/**
* External active call to switch to human service
* @param context
* @param param Switch to human service parameter
*/
ZCSobotApi.connectCustomerService(context, param);
2
3
4
5
6
# ● Human Customer Service
# 1. Connect to the specified skill group
Get the skill group number in the background:

Configure the skill group ID in the SDK code:
//Preset skill group ID
info.setGroupid("your groupId");
//Preset skill group name, optional
info.setGroup_name("your groupName");
2
3
4
Note: This field is optional. If you pass a skill group ID, the SDK will skip the skill group selection popup after transferring to manual service and directly route to the specified skill group.
# 2. Connect to the designated customer service representative
Get the specified customer service ID in the background:


Set in the SDK code:
// Transfer type (0 - Can transfer to other customer service, 1 - Must transfer to designated customer service)
info.setTranReceptionistFlag(1);
// Designated customer service id
info.setChoose_adminid("your Customer service id");
2
3
4
Attention:
Choose_adminid: Specify the customer service representative to connect with. If not set, the default will be used.
TranReceptionistFlag: Set whether it must be transferred to the designated customer service after specifying the customer service. 0: Can be transferred to other customer service, 1: Must be transferred to the designated customer service. Note: If set to 1, when the designated customer service is not online, it cannot be transferred to other customer service.
# 3. Set up user-defined profiles and custom fields
Developers can directly pass in these user details for customer service to view.
Configure the fields you need to display on the workbench by yourself. The configuration method is shown in the figure below:

// Set user custom fields, key must be the ID corresponding to the backend field
Map<String,String> customerFields = new HashMap<>();
customerFields.put("weixin", "your wechat");
customerFields.put("weibo", "your weibo");
customerFields.put("sex", "female");
customerFields.put("birthday", "2017-05-17");
info.setCustomer_fields(customerFields);
2
3
4
5
6
7
User-defined information
Method 1: Map Method
//Custom user data
Map<String, String> customInfo = new HashMap<>();
customInfo.put("Data", "aaaaa");
info.setParams(customInfo);
2
3
4
Method Two: Json Method
// Custom user information. The string must be in JSON format, otherwise it may not display correctly.
info.setParams("{\"title\":\"Title\",\"url\":\"https://www.baidu.com\"}");
2
The effect image is as follows:

# 4. Set to send messages automatically after a successful transfer
The SDK can be set to automatically send a message after a successful transfer. You can choose whether to send the message every time you enter the chat page. By default, it is sent only once.
//Send text message
//Set sending mode
//SobotAutoSendMsgMode.Default Default, do not send
//SobotAutoSendMsgMode.SendToRobot Send to robot only
//SobotAutoSendMsgMode.SendToOperator Send to human agent only
//SobotAutoSendMsgMode.SendToAll Send to all
//setIsEveryTimeAutoSend Whether to send every time entering the chat page
info.setAutoSendMsgMode(SobotAutoSendMsgMode.SendToAll.setContent("your msg").setIsEveryTimeAutoSend(false));
//After transferring to human agent successfully, text, image, video, and file can be sent (only in human mode). Local file path and sending type need to be set.
//SobotAutoSendMsgMode.ZCMessageTypeText Text (default)
//SobotAutoSendMsgMode.ZCMessageTypePhoto Image
//SobotAutoSendMsgMode.ZCMessageTypeFile File
//SobotAutoSendMsgMode.ZCMessageTypeVideo Video
String path = CommonUtils.getSDCardRootPath() + File.separator + "2.jpg";
//path = "Sending content";
//path = CommonUtils.getSDCardRootPath() + File.separator + "3.mp4";
//path = CommonUtils.getSDCardRootPath() + File.separator + "1.txt";
info.setAutoSendMsgMode(SobotAutoSendMsgMode.SendToOperator.setContent(path).setAuto_send_msgtype(SobotAutoSendMsgMode.ZCMessageTypePhoto));
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 5. Set up priority access for designated customers in queue
The SDK can set the current user's queue priority. When this user enters the queue, they will be served first.
// Set priority access in queue: true: priority access, false: default value, normal queue
info.setIs_Queue_First(true);
2
# 6. Set Service Summary Custom Fields
The SDK can configure custom fields for service summaries, allowing customer service to create session summaries more quickly.
- Get Custom Field ID


- Set custom fields for service summary (Support passing service summary parameters when transferring to human agent)
// Service summary custom fields
Map<String, String> summaryInfo = new HashMap<>();
summaryInfo.put("your keyId", "your value");
info.setSummary_params(summaryInfo);
2
3
4
# 7. Set Parameters for Multi-turn Conversation Interface
When using the multi-turn conversation feature, we will pass two fixed custom parameters, uid and multiParams, to each interface. The uid is the unique identifier of the user, and multiParams is a custom field in JSON string format. If the user has integrated these two fields, we will send them back to the third-party interface. If not, we will pass empty fields.
// Custom parameters for multi-turn conversation
info.setMulti_params("{\"key1\",\"val1\"}");
2
# 8. Product inquiry information and support for sending message cards directly, only supported in manual mode
When users chat with customer service, they often need to send product or order inquiries to customer service for viewing. The inquiry object currently supports up to 5 attributes (title, imgUrl, fromUrl, describe, lable), where (title, fromUrl) are required fields. The following example demonstrates this using a product:
// Inquiry content
ConsultingContent consultingContent = new ConsultingContent();
// Inquiry content title, required
consultingContent.setSobotGoodsTitle("XXX Super TV 50-inch 2D Smart LED Black");
// Inquiry content image, optional but must be an image URL
consultingContent.setSobotGoodsImgUrl("http://www.li7.jpg");
// Source page of the inquiry, required
consultingContent.setSobotGoodsFromUrl("www.sobot.com");
// Description, optional
consultingContent.setSobotGoodsDescribe("XXX Super TV S5");
// Tag, optional
consultingContent.setSobotGoodsLable("¥2150");
// Whether to automatically send after switching to human agent
consultingContent.setAutoSend(true);
// Whether to resend every time when re-entering the chat page: true means always send, false means send only once. Default is sending only once.
consultingContent.setEveryTimeAutoSend(false);
// Start the Sobot customer service page and add in Information, send card message when switching to human agent
info.setConsultingContent(consultingContent);
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
The effect picture is as follows:

# 9. Send order card, supported only in manual mode. The click event of the order card can be intercepted.
Usage 1: When starting Sobot customer service, automatically send order card messages.
List<OrderCardContentModel.Goods> goodsList = new ArrayList<>();
goodsList.add(new OrderCardContentModel.Goods("Apple", "https://img.sobot.com/chatres/66a522ea3ef944a98af45bac09220861/msg/20190930/7d938872592345caa77eb261b4581509.png"));
goodsList.add(new OrderCardContentModel.Goods("Apple1111111", "https://img.sobot.com/chatres/66a522ea3ef944a98af45bac09220861/msg/20190930/7d938872592345caa77eb261b4581509.png"));
goodsList.add(new OrderCardContentModel.Goods("Apple2222", "https://img.sobot.com/chatres/66a522ea3ef944a98af45bac09220861/msg/20190930/7d938872592345caa77eb261b4581509.png"));
goodsList.add(new OrderCardContentModel.Goods("Apple33333333", "https://img.sobot.com/chatres/66a522ea3ef944a98af45bac09220861/msg/20190930/7d938872592345caa77eb261b4581509.png"));
OrderCardContentModel orderCardContent = new OrderCardContentModel();
//Order number (required)
orderCardContent.setOrderCode("zc32525235425");
//Order status
//Pending payment:1 Pending shipment:2 In transit:3 Out for delivery:4 Completed:5 Pending review:6 Cancelled:7
orderCardContent.setOrderStatus(1);
//Custom order status name. Only valid when the order status is 0, other values follow the original logic.
//orderCardContent.setOrderStatus(0);
//orderCardContent.setStatusCustom("Your custom status");
//Total order amount (in cents)
orderCardContent.setTotalFee(1234);
//Total number of order items
orderCardContent.setGoodsCount("4");
//Order link
orderCardContent.setOrderUrl("https://item.jd.com/1765513297.html");
//Order creation time
orderCardContent.setCreateTime(System.currentTimeMillis() + "");
//Whether to send automatically after transferring to a human agent
orderCardContent.setAutoSend(true);
//Whether to resend every time entering the chat page. True means always send, false means send only once, default is send only once.
orderCardContent.setEveryTimeAutoSend(false);
//Order item list
orderCardContent.setGoods(goodsList);
//Order card content
info.setOrderGoodsInfo(orderCardContent);
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Usage Two: After transferring to a human agent, you can add an order button in the plus sign. Click it to send an order message to the customer service.
final String ACTION_SEND_ORDERCARD = "sobot_action_send_ordercard";
ChattingPanelUploadView.SobotPlusEntity ordercardEntity = new ChattingPanelUploadView.SobotPlusEntity(ResourceUtils.getDrawableId(getApplicationContext(), "sobot_ordercard_btn_selector"), ResourceUtils.getResString(getApplicationContext(), "sobot_ordercard"), ACTION_SEND_ORDERCARD);
tmpList.add(ordercardEntity);
SobotUIConfig.pulsMenu.operatorMenus = tmpList;
//sSobotPlusMenuListener can only have one, otherwise, the latter will overwrite the former (for example: in the plus menu,
//when customizing both location and order buttons, you can determine which button was clicked by action and handle it accordingly)
SobotUIConfig.pulsMenu.sSobotPlusMenuListener = new SobotPlusMenuListener() {
@Override
public void onClick(View view, String action) {
if (ACTION_SEND_ORDERCARD.equals(action)) {
Context context = view.getContext();
List<OrderCardContentModel.Goods> goodsList = new ArrayList<>();
goodsList.add(new OrderCardContentModel.Goods("Apple", "https://img.sobot.com/chatres/66a522ea3ef944a98af45bac09220861/msg/20190930/7d938872592345caa77eb261b4581509.png"));
OrderCardContentModel orderCardContent = new OrderCardContentModel();
//Order number (required)
orderCardContent.setOrderCode("zc32525235425");
//Order status
//Pending payment:1 Awaiting shipment:2 In transit:3 Out for delivery:4 Completed:5 Pending review:6 Cancelled:7
orderCardContent.setOrderStatus(1);
//Custom order status name. Only valid when order status is 0. For other values, follow the original logic.
//orderCardContent.setOrderStatus(0);
//orderCardContent.setStatusCustom("Your custom status");
//Total order amount (unit is cents)
orderCardContent.setTotalFee(1234);
//Total number of goods in the order
orderCardContent.setGoodsCount("4");
//Order link
orderCardContent.setOrderUrl("https://item.jd.com/1765513297.html");
//Order creation time
orderCardContent.setCreateTime(System.currentTimeMillis() + "");
//Whether to send automatically after transferring to human agent
orderCardContent.setAutoSend(true);
//Whether to resend every time the chat page is entered again. True: resend every time, false: send only once (default).
orderCardContent.setEveryTimeAutoSend(false);
//Order goods list
orderCardContent.setGoods(goodsList);
ZCSobotApi.sendOrderGoodsInfo(context, orderCardContent);
}
}
};
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
To configure order card interception, you can also use ZCSobotApi.setNewHyperlinkListener() for interception; after setOrderCardListener intercepts, setNewHyperlinkListener will not intercept anymore.
ZCSobotApi.setOrderCardListener(new SobotOrderCardListener() {
@Override
public void onClickOrderCradMsg(OrderCardContentModel orderCardContent) {
ToastUtil.showToast(getApplicationContext(), "Clicked the order card" );
}
});
2
3
4
5
6
The effect picture is shown below:

# 10. Set whether the user is a VIP and the user's VIP level
// You can set this when starting Sobot customer service
// Specify whether the customer is a VIP, 0: normal 1: VIP
info.setIsVip("1");
// Set the VIP level by name; VIP levels can be edited in the Sobot management console (System Settings > Custom Fields > Customer Fields), and you can get the ID or name corresponding to the level
info.setVip_level("Honorable");
2
3
4
5
# 11. Set User-Defined Tags
//You can set this when starting Sobot customer service
//User tags can be edited in the Sobot management console (System Settings > Custom Fields > Customer Fields), and you can get the ID or name corresponding to the user tag
//You can add multiple user tags, separate multiple tag IDs or names with a comma
info.setUser_label("Celebrity,Journalist");
2
3
4
# 12. Send custom cards to the conversation history and recommend them to customers in a systematic way
Custom Card Parameter Description Document (opens new window)
//1. Create SobotChatCustomCard data
SobotChatCustomCard customCard = new SobotChatCustomCard();
// Card id
customCard.setCardId("cardId12121212");
// Recommended display mode, default false. The card can only be sent to the user in manual mode; true means the card can also be sent in machine mode. One session can only send once.
customCard.setShowCustomCardAllMode(true);
// Card type 0, "Order card", 1, "Product card"
customCard.setCardType(rg_card_type.getCheckedRadioButtonId() == R.id.rg_dingdan ? 0 : 1);
// Card style 0, "Flat" 1, "List"
customCard.setCardStyle(rg_card_style.getCheckedRadioButtonId() == R.id.rg_pingpu ? 0 : 1);
// Whether to send as customer identity: 0: "System identity", 1: "Customer identity". Supported from v4.1.4 version.
customCard.setIsCustomerIdentity(0);
// Configure top guide text, image, and card description
customCard.setCardDesc("Test description test description test description test description test description test description test description test description");
customCard.setCardGuide("Test title Guide text Test title Guide text Test title Guide text Test title Guide text Test title Guide text Test title Guide text");
customCard.setCardImg("https://hk.sobot.com/auth/_next/static/media/sideZh.74024132.png");
customCard.setCardLink("https://www.sobot.com");
// Configure custom click buttons
List<SobotChatCustomMenu> menus = new ArrayList<>();
SobotChatCustomMenu m = new SobotChatCustomMenu();
m.setMenuLink("sdfsfdsfsdfsfdsfsdfsfdsf");
m.setMenuLinkType(0);
m.setMenuType(2);
m.setMenuName("Send");
m.setMenuTip("Send tip");
menus.add(m);
SobotChatCustomMenu mm = new SobotChatCustomMenu();
mm.setMenuLink("sdfsfdsf");
mm.setMenuLinkType(2);
mm.setMenuType(1);
mm.setMenuName("Confirm");
mm.setMenuTip("Send tip");
menus.add(mm);
SobotChatCustomMenu mmm = new SobotChatCustomMenu();
mmm.setMenuLink("sdfsfdsf");
mmm.setMenuLinkType(2);
mmm.setMenuType(0);
mmm.setMenuName("View details sdf sdf sdf sdf sdf sdf sdf");
mmm.setMenuTip("Send tip");
menus.add(mmm);
customCard.setCardMenus(menus);
// Configure custom fields
Map<String, Object> param = new HashMap<>();
param.put("Test", "0999999999999990");
customCard.setCustomField(param);
// Configure custom card middle list part
List<SobotChatCustomGoods> goods = new ArrayList<>();
int goodsNum = 3;
for (int i = 0; i < goodsNum; i++) {
SobotChatCustomGoods g = new SobotChatCustomGoods();
// Robot standard question, can be "", supported from v4.1.4 version
g.setCustomCardQuestion("First standard question");
g.setCustomCardAmount("222.9");
g.setCustomCardTime("2023-06-25 14:32:21");
g.setCustomCardCode("sobot121u321u3");
g.setCustomCardStatus("Pending receipt");
g.setCustomCardCount("5");
g.setCustomCardAmountSymbol("¥");
g.setCustomCardName(i + "Test email I am is is is is is is is is buzz buzz buzz buzz buzz buzz buzz buzz what what what what Microsoft Microsoft Microsoft Microsoft Microsoft Microsoft");
g.setCustomCardId("cardId_" + i);
g.setCustomCardDesc("Test email I am is is is is is is is is buzz buzz buzz buzz buzz buzz buzz buzz what what what what Microsoft Microsoft Microsoft Microsoft Microsoft Microsoft");
g.setCustomCardThumbnail("https://hk.sobot.com/auth/_next/static/media/sideZh.74024132.png");
if (i == 0) {
List<SobotChatCustomMenu> menus2 = new ArrayList<>();
menus2.add(m);
g.setCustomMenus(menus2);
} else if (i == 1) {
List<SobotChatCustomMenu> menus2 = new ArrayList<>();
menus2.add(m);
menus2.add(mm);
g.setCustomMenus(menus2);
} else {
List<SobotChatCustomMenu> menus2 = new ArrayList<>();
menus2.add(m);
menus2.add(mm);
menus2.add(mmm);
g.setCustomMenus(menus2);
}
goods.add(g);
}
customCard.setCustomCards(goods);
// Set card
info.setCustomCard(customCarddange);
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# ● Message Ticket Related
# 1. Workbench Setup Message Interface
You can set up the message interface on the workbench.

# 2. Custom Configuration of User Information on the Message Page
The verification and display logic for the three parameters of email, phone, and attachment in the message can be configured on the PC console page.

# 3. Jump to the message page
/**
* Jump to the message leaving interface
*
* @param context Context Required
* @param info User's appkey Required. If the user is from a platform, pass the parent company's appkey.
* @param isOnlyShowTicket true shows only the message record interface, false shows both the "Leave a Message" and message record interfaces.
*/
ZCSobotApi.openLeave(Context context, Information info, boolean isOnlyShowTicket);
2
3
4
5
6
7
8
Example code:
Information info = new Information();
info.setApp_key(et_appkey.getText().toString());/* Required */
// Ticket Skill Group
info.setLeaveMsgGroupId("6576d173af904d97b1d5d01a11cc66f5");
Map<String,String> map=new HashMap<>();
// Custom field, key corresponds to the ID of the backend-added field
map.put("834b34870b2e47daa1904d8f63ee55c2","zzz");
info.setLeaveCusFieldMap(map);
// Specify the message template ID to jump to a designated message interface
info.setLeaveTemplateId("7800560a37784ce1be064915c8389d28");
ZCSobotApi.openLeave(SobotStartActivity.this, info, false);
2
3
4
5
6
7
8
9
10
11
# 4. Message Page Event Interception
SDK allows messages to redirect to a custom page. If you have this requirement, you can use the following method to set it up:
ZCSobotApi.setSobotLeaveMsgListener(new SobotLeaveMsgListener() {
@Override
public void onLeaveMsg() {
ToastUtil.showToast(getApplicationContext(),"Implement the method here, navigate to the page");
}
});
2
3
4
5
6
# 5. The reply button on the message details interface in the completed status can be configured to show or hide through parameters.
// For completed status messages, can users continue to reply? True means they can continue, false means they cannot.
// Default is true, allowing users to keep replying continuously.
ZCSobotApi.setSwitchMarkStatus(MarkConfig.LEAVE_COMPLETE_CAN_REPLY, true);
2
3
# 6. Get Message Replies
/**
* Get the list of unread message replies. If there are unread message replies, display the latest one in the notification bar. Click the notification to go to the message details page.
*
* If you use a method similar to scheduled tasks to get the latest message replies in real time, the interval between two requests must be greater than 60 seconds for the interface to return data.
*
* @param context Context Required
* @param partnerId Unique user identifier, consistent with the partnerid passed in information
* @param noReadLeaveReplyListener Callback for getting the list of unread message replies, SobotLeaveReplyModel: Single message reply object
*/
ZCSobotApi.getLastLeaveReplyMessage(SobotStartActivity.this,"your partnerid", new SobotNoReadLeaveReplyListener() {
@Override
public void onNoReadLeaveReplyListener(List<SobotLeaveReplyModel> sobotLeaveReplyModelList) {
if(sobotLeaveReplyModelList!=null&&sobotLeaveReplyModelList.size()>0){
// Send message reply notification. After clicking the notification, go to the message details page.
ZCSobotApi.sendLeaveReplyNotification(SobotStartActivity.this, sobotLeaveReplyModelList.get(0), R.drawable.sobot_logo_small_icon, R.drawable.sobot_logo_small_icon);
}
}
@Override
public void onFailureListener(String erroMsg) {
// Request failed due to network issues
}
});
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 7. Add a switch for proactively reminding users to leave a message or review
// Completed message details page - Not evaluated: Whether to pop up the service evaluation window when returning (It will only pop up the first time, and will not pop up again on subsequent returns). Default is false (not popping up).
info.setShowLeaveDetailBackEvaluate(true);
2
# 8. Add extended parameters for leaving a message
// Add message connection fields
List<SobotLeaveMsgFieldModel> leaveParamsExtends = new ArrayList<>();
// SobotLeaveMsgFieldModel attribute description; ID: Automatically generated ID by the connection field system; Value: Data to be passed; Params: Field ID for display, such as city, address, corresponding to ID; Data is configured from the backend console
leaveParamsExtends.add(new SobotLeaveMsgFieldModel("your id", "your value", "your params"));
info.setLeaveParamsExtends(leaveParamsExtends);
// Add message skill group
info.setLeaveMsgGroupId("your groupId");
// Add custom message fields, key corresponds to the backend added field ID
Map<String,String> map=new HashMap<>();
map.put("your field key","zzz");
info.setLeaveCusFieldMap(map);
2
3
4
5
6
7
8
9
10
11
12
13
# ● Evaluation
# 1. Set up the evaluation interface
You can set it on the workbench, satisfaction evaluation interface:

# 2. Whether a satisfaction rating pops up when clicking back on the left side of the navigation bar
Note: The satisfaction rating window can only pop up after the user has sent a message.
// Whether to pop up a confirmation dialog when clicking back (Are you sure to end the session?)
info.setShowLeftBackPop(true);
// Whether to show satisfaction evaluation when clicking back on the left side of the navigation bar. True shows, false does not; default is false.
info.setShowSatisfaction(false);
2
3
4
The effect images are as follows:


# 3. Whether the close button on the right side of the navigation bar is displayed and whether a satisfaction rating pops up when clicked
Note: The satisfaction evaluation window can only pop up after the user has sent a message.
// Set whether to show the close button on the right side of the navigation bar. True shows, false hides; default is false
info.setShowCloseBtn(false);
// Set whether to pop up the satisfaction evaluation when clicking the close button on the right side of the navigation bar. True pops up, false does not pop up; default is false
info.setShowCloseSatisfaction(false);
2
3
4
# 4. Configure the session to be released after the user submits a manual satisfaction evaluation
/**
* Configure to release the session after the user submits a manual satisfaction rating
* @param context Context object
* @param flag true means release the session, false means do not release the session
*/
ZCSobotApi.setEvaluationCompletedExit(context,flag);
2
3
4
5
6
# 5. When returning from the top left corner and closing from the top right corner, whether to display the "Not Evaluate for Now" button in the manual satisfaction evaluation pop-up interface configuration
/**
* Top-left return and top-right close. When returning to the evaluation pop-up window, whether to display the "Not Evaluate for Now" button. Default is false (not displayed).
*/
info.setCanBackWithNotEvaluation(true);
2
3
4
# ● Message Related
# 1. Send Text Messages
If your APP needs to actively send text messages to customer service, please use the following code:
/**
* Send text message
* @param context
* @param content Text content
*/
ZCSobotApi.sendTextToUser(Context context,String content)
2
3
4
5
6
# 2. Set whether to enable message notifications
When the user is not on the chat interface and receives a message from customer service, the app can show a reminder in the notification bar. Clicking the notification bar reminder will redirect to the chat interface.
/**
* Set whether to enable message notifications. Default is no reminders.
* @param context
* @param flag
* @param smallIcon The ID of the small icon. Set the small image in the notification bar. Recommended size is generally 24x24.
* @param largeIcon The ID of the large icon.
*/
public static void setNotificationFlag(Context context, boolean flag, int smallIcon, int largeIcon);
2
3
4
5
6
7
8
Example code:
// Set whether to enable message notifications
ZCSobotApi.setNotificationFlag(getApplicationContext(), true, R.drawable.sobot_logo_small_icon, R.drawable.sobot_logo_icon);
2
# 3. Set Up Offline Messages
Enable offline messages:
// Enable the channel to receive offline messages. After enabling, messages will be sent in a broadcast format. If this feature is not needed, you can skip the call.
ZCSobotApi.checkIMConnected(getApplicationContext(), "uid");
2
Close offline messages:
// Close the channel and clear the current session cache
ZCSobotApi.closeIMConnection(getApplicationContext());
2
# 4. Register broadcast, get newly received messages
After registering the broadcast, you can get newly received messages when the message channel is connected.
1 Register Broadcast
/**
* action:ZhiChiConstants.sobot_unreadCountBrocast
*/
IntentFilter filter = new IntentFilter();
filter.addAction(ZhiChiConstant.sobot_unreadCountBrocast);
contex.registerReceiver(receiver, filter);
2
3
4
5
6
2 Receive new information
Receive information in the onReceive method of BroadcastReceiver.
public class MyReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// New message content
String content = intent.getStringExtra("content");
Bundle bundle = intent.getExtras();
ZhiChiPushMessage message = (ZhiChiPushMessage) bundle.get("sobotMessage");
LogUtils.i(" New message content:" + content);
LogUtils.i(" Message object:" + message.toString());
unread_msg_num.setText(noReadNum + "");
}
}
2
3
4
5
6
7
8
9
10
11
12
# 5. Send Location Message
If your APP needs to send the customer's location information, please follow the steps below to set it up (note that map positioning needs to be developed by the developer).
- The configuration location of the send button in the customer service chat interface (displayed in the menu panel after clicking the "+" button, shown only after switching to human service), the code is as follows:
// Menu action When a button is clicked, the corresponding action will be returned to the callback as a basis,
// to determine which button the user clicked. You can define it yourself.
final String ACTION_LOCATION = "sobot_action_location";
// Configure the location sending button
ChattingPanelUploadView.SobotPlusEntity locationEntity = new ChattingPanelUploadView.SobotPlusEntity(R.drawable.sobot_location_btn_selector, ResourceUtils.getResString(getApplicationContext(), "sobot_location"), ACTION_LOCATION);
List<ChattingPanelUploadView.SobotPlusEntity> tmpList = new ArrayList<>();
tmpList.add(locationEntity);
SobotUIConfig.pulsMenu.operatorMenus = tmpList;
2
3
4
5
6
7
8
- Set the callback for the location send button:
//sSobotPlusMenuListener can only have one, otherwise, the later one will override the previous one (for example: in the plus menu,
//if both a custom location button and an order button are added, you can use "action" to determine which button is clicked and handle accordingly)
SobotUIConfig.pulsMenu.sSobotPlusMenuListener = new SobotPlusMenuListener() {
@Override
public void onClick(View view, String action) {
if (ACTION_LOCATION.equals(action)) {
Context context = view.getContext();
//After obtaining location information on the map positioning page, send it to customer service:
SobotLocationModel locationData = new SobotLocationModel();
//Map snapshot, must pass in the local image path. Note: If not passed, a default map image will be displayed
locationData.setSnapshot(Environment.getExternalStorageDirectory().getAbsolutePath() +"/1.png");
//Latitude
locationData.setLat("40.057406655722");
//Longitude
locationData.setLng("116.2964407172");
//Landmark name
locationData.setLocalName("Jinma Building");
//Landmark address
locationData.setLocalLabel("Jinma Building, Liudaoqiao, Haidian District, Beijing");
ZCSobotApi.sendLocation(context, locationData);
}
}
};
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 6. Customize click events for hyperlinks (Intercept scope: Help Center, Messages, Chat, Message History, Product Card, Order Card, Location Card)
// Link click event, determine whether to intercept based on the return result. If true is returned, intercept; if false, do not intercept.
// It can be an order number, product details address, etc. Customers can define custom rules for interception. When returning true, custom information will be returned.
// Interception scope (Help Center, Messages, Chat, Message Records, Product Cards, Order Cards)
ZCSobotApi.setNewHyperlinkListener(new NewHyperlinkListener() {
@Override
public boolean onUrlClick(String url) {
// Example
if (url.contains("baidu.com")) {
ToastUtil.showToast(getApplicationContext(), "Clicked hyperlink, url=" + url);
// If the url link is Baidu, intercept
// do().....
return true;
}
// Example
if (url.contains("Order Number: 123456789")) {
ToastUtil.showToast(getApplicationContext(), "Clicked hyperlink, url=" + url);
// If the link is an order card, intercept
// do().....
return true;
}
return false;
}
@Override
public boolean onEmailClick(String email) {
ToastUtil.showToast(getApplicationContext(), "Clicked email, email=" + email);
return false;
}
@Override
public boolean onPhoneClick(String phone) {
ToastUtil.showToast(getApplicationContext(), "Clicked phone number, phone=" + phone);
return false;
}
});
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Set the callback for the location card click event:
// After clicking the location card, Baidu Map will be opened by default. If Baidu Map is not installed, then Amap will be opened; you can intercept the location card click event and handle it yourself.
SobotOption.mapCardListener = new SobotMapCardListener() {
@Override
public boolean onClickMapCradMsg(Context context, SobotLocationModel locationModel) {
if (context != null && locationModel != null) {
ToastUtil.showCustomToast(context, "Intercept the location card click event");
// Open Amap first
//StMapOpenHelper.firstOpenGaodeMap(context, locationModel);
// Open Baidu Map first
//StMapOpenHelper.firstOpenBaiduMap(context, locationModel);
}
// Return true to intercept; return false not to intercept
return true;
}
};
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 7. Listen for changes in the current chat mode
ZCSobotApi.setChatStatusListener(new SobotChatStatusListener() {
@Override
public void onChatStatusListener(SobotChatStatusMode chatStatusMode) {
switch (chatStatusMode) {
case ZCServerConnectRobot:
ToastUtil.showToast(getApplicationContext(), "Robot chat mode");
break;
case ZCServerConnectArtificial:
ToastUtil.showToast(getApplicationContext(), "Switch to human customer service chat mode");
break;
case ZCServerConnectOffline:
ToastUtil.showToast(getApplicationContext(), "Offline");
break;
case ZCServerConnectWaiting:
ToastUtil.showToast(getApplicationContext(), "Waiting in queue for human support only");
break;
}
}
});
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 8. Regular expression for replacing mobile or landline numbers in messages
ZCSobotApi.replacePhoneNumberPattern(String regex);
# 9. Replace the regular expression for hyperlink recognition in messages
ZCSobotApi.replaceWebUrlPattern(String regex);
# 10. Hide time prompts in the message list
//isHide true hides, false shows. Default is false
ZCSobotApi.hideTimemsgForMessageList(Context context, boolean isHide);
2
# Function Customization
# ● UI Setting Instructions
To ensure the interface style of the customer service window is consistent with the overall APP that integrates the Sobot customer service SDK, the Sobot customer service SDK provides simple UI customization options.
# 1. Configure Attribute Values
The following attributes can be set in the oncreate() method of Application:
// Set whether the first button on the right of the toolbar is displayed, default is displayed
SobotUIConfig.sobot_title_right_menu1_display = true;
// Set whether the second button on the right of the toolbar is displayed, default is hidden (evaluation)
SobotUIConfig.sobot_title_right_menu2_display = true;
// Set whether the third button on the right of the toolbar is displayed, default is hidden
SobotUIConfig.sobot_title_right_menu3_display = true;
// Modify the image of the third button on the right of the toolbar (phone icon R.drawable.sobot_phone)
SobotUIConfig.sobot_title_right_menu3_bg = R.drawable.sobot_phone;
// Set the phone number that the third button on the right of the toolbar needs to call
SobotUIConfig.sobot_title_right_menu3_call_num = "18510000000";
2
3
4
5
6
7
8
9
10
# 2. Control the switch for horizontal and vertical screen display
// true for landscape, false for portrait; default is false for portrait
ZCSobotApi.setSwitchMarkStatus(MarkConfig.LANDSCAPE_SCREEN, false);
2
# 3. Whether to turn on the notch screen switch in landscape mode
// Only works in landscape mode; portrait mode is adapted, you can modify the status bar color
// true to turn on, false to turn off; default is false (off)
ZCSobotApi.setSwitchMarkStatus(MarkConfig.DISPLAY_INNOTCH, true);
2
3
# 4. UI Style Replaced by Resource with the Same Name
In the customer APP, adding a color with the same name in colors.xml can override the color style in the Sobot SDK; you can also replace the image in the Sobot SDK interface by placing an image resource with the same name in the same location in the main project; similarly, you can replace the text in the Sobot SDK interface by placing a text resource with the same name in the same location in the main project.
The following are commonly used color configurations. You can find more colors and image resources by downloading the source code package in the manual integration module.
<!-- Default theme color, green -->
<color name="sobot_color">@color/sobot_common_green</color>
<color name="sobot_color_transparency_10">@color/sobot_common_green_transparency_10</color>
<!-- Text color Primary text color Most black text in the interface -->
<color name="sobot_color_text_first">#161616</color>
<!-- Text color Secondary text color -->
<color name="sobot_color_text_second">#777474</color>
<!-- Text color Placeholder text color -->
<color name="sobot_color_text_third">#A3A5A8</color>
<!-- General Background color -->
<color name="sobot_color_common_bg">#F5F5F5</color>
<!-- Background color Level 1 -->
<color name="sobot_color_bg_first">#FFFFFF</color>
<!-- Background color Level 2 Secondary black background (popup background, chat bottom operation bar, cell) -->
<color name="sobot_color_bg_second">#F5F5F5</color>
<!-- Background color Level 3 Bubble containing other content background (multi-round conversation, product) -->
<color name="sobot_color_bg_third">#FFFFFF</color>
<!-- Background color Chat page Bottom Quick menu Input box area Extended menu -->
<color name="sobot_color_bg_four">#FFFFFF</color>
<!-- Line Button border color -->
<color name="sobot_color_line_button_frame">#D9D9D9</color>
<!-- Line Divider color -->
<color name="sobot_color_line_divider">#EBEBEB</color>
<!-- Line Divider color 2 -->
<color name="sobot_color_line_divider_2">#F5F5F5</color>
<!-- Header start -->
<!-- Header navigation bar and status bar default gradient background Left start -->
<color name="sobot_color_title_bar_left_bg">@color/sobot_color_bg_first</color>
<!-- Header navigation bar and status bar default gradient background Right end -->
<color name="sobot_color_title_bar_bg">@color/sobot_color_bg_first</color>
<!-- Header nickname color -->
<color name="sobot_color_title_bar_nike_name">@color/sobot_white</color>
<!-- Header company name color -->
<color name="sobot_color_title_bar_company_name">@color/sobot_white</color>
<!-- Header side menu font color -->
<color name="sobot_color_title_bar_menu_text">@color/sobot_white</color>
<!-- Top no network message Background color -->
<color name="sobot_no_net_bgcolor">#FFF1F0</color>
<!-- Announcement layout background color -->
<color name="sobot_announcement_bgcolor">#FFFBE6</color>
<!-- Announcement title font color -->
<color name="sobot_announcement_title_color">#161616</color>
<!-- Announcement card Horizontal line color -->
<color name="sobot_announcement_line_color">#1AFA8314</color>
<!-- Hyperlink text color in non-top announcements -->
<color name="sobot_announcement_link_color">@color/sobot_common_blue</color>
<!-- Middle Chat list -->
<!-- Chat background -->
<color name="sobot_color_chat_bg">@color/sobot_color_bg_first</color>
<!-- Text message bubble Left side Black text -->
<color name="sobot_left_msg_text_color">@color/sobot_color_text_first</color>
<!-- Text message bubble Left side Light gray text Used for descriptions -->
<color name="sobot_left_msg_text_color_des">@color/sobot_color_text_third</color>
<!-- Text message bubble Right side White text -->
<color name="sobot_right_msg_text_color">@color/sobot_white</color>
<!-- Hyperlink color Left side -->
<color name="sobot_color_link">@color/sobot_common_blue</color>
<!-- Hyperlink color Right side -->
<color name="sobot_color_rlink">@color/sobot_common_blue</color>
<!-- Chat interface reminder font color -->
<color name="sobot_color_remind_text">@color/sobot_color_text_third</color>
<!-- Hyperlink color in message reminders -->
<color name="sobot_color_link_remind">@color/sobot_color</color>
<!-- File message bubble color -->
<color name="sobot_chat_file_bgColor">@color/sobot_color</color>
<!-- Left side message bubble default background color -->
<color name="sobot_chat_left_bgColor">@color/sobot_color_bg_second</color>
<!-- Right side message bubble default background color Gradient Left start -->
<color name="sobot_chat_right_bgColor_start">@color/sobot_gradient_start</color>
<!-- Right side message bubble default background color Gradient Right end -->
<color name="sobot_chat_right_bgColor_end">@color/sobot_gradient_end</color>
<!-- Left side message bubble nickname color -->
<color name="sobot_chat_left_nikename_color">@color/sobot_color_text_third</color>
<!-- Right side message bubble nickname color -->
<color name="sobot_chat_right_nikename_color">@color/sobot_color_text_third</color>
<!-- Quoted message -->
<!-- Text message bubble Left side Quote type color Black text -->
<color name="sobot_left_appoint_msg_type_color">@color/sobot_color_text_second</color>
<!-- Text message bubble Left side Quote content color Black text -->
<color name="sobot_left_appoint_msg_text_color">@color/sobot_color_text_third</color>
<!-- Text message bubble Left side Quote card inside color Black text -->
<color name="sobot_left_appoint_msg_card_text_color">@color/sobot_color_text_first</color>
<!-- Text message bubble Right side Quote type color White text -->
<color name="sobot_right_appoint_msg_type_color">#E6FFFFFF</color>
<!-- Text message bubble Right side Quote content color White text -->
<color name="sobot_right_appoint_msg_text_color">#D9FFFFFF</color>
<!-- Right side message bubble line color -->
<color name="sobot_chat_right_line">#99FFFFFF</color>
<!-- Left side message bubble line color -->
<color name="sobot_chat_left_line">#CCCCCC</color>
<!-- Right side quoted message Quoted part background color -->
<color name="sobot_chat_appoint_right_transparent_bg">#24FFFFFF</color>
<!-- Left side quoted message Quoted part background color -->
<color name="sobot_chat_appoint_left_transparent_bg">#FFFFFF</color>
<!-- Quoted message Small square placeholder background color -->
<color name="sobot_chat_appoint_zhanwei_bg">#CDD9EA</color>
<!-- Image control with preload effect background color -->
<color name="sobot_color_progress_image_bg">#EBEBEB</color>
<!-- Bottom -->
<!-- Recording animation panel background color Gradient -->
<color name="sobot_color_chat_bottom_record_sound_bg_start">#00FFFFFF</color>
<color name="sobot_color_chat_bottom_record_sound_bg_end">#FFFFFF</color>
<!-- Chat page Bottom Quick menu Input box area Extended menu background color -->
<color name="sobot_color_chat_bottom_bg">@color/sobot_color_bg_four</color>
<!-- Custom label border color -->
<color name="sobot_lable_stroke_color">@color/sobot_color_line_divider</color>
<!-- Custom label default fill color -->
<color name="sobot_lable_nomal_bg_color">@color/sobot_color_chat_bottom_bg</color>
<!-- Custom label font color -->
<color name="sobot_lable_text_color">@color/sobot_color_text_first</color>
<!-- Message input box Text color -->
<color name="sobot_color_bottom_msg_input_color">@color/sobot_color_text_first</color>
<!-- Panel background after clicking plus button -->
<color name="sobot_color_bottom_bg">@color/sobot_white</color>
<!-- Panel background Button font color after clicking plus button -->
<color name="sobot_color_bottom_btn_wz_color">@color/sobot_color_text_first</color>
<!-- Prompt dialog Button text color -->
<color name="sobot_color_dialog_btn_content_color">@color/sobot_common_blue</color>
<!-- Leave message related -->
<!-- Leave message Navigation bar tab Text underline color -->
<color name="sobot_postMsg_nav_indicator_color">@color/sobot_white</color>
<!-- Leave message Navigation bar tab Selected font color -->
<color name="sobot_postMsg_nav_sel_tx_color">@color/sobot_white</color>
<!-- Leave message Navigation bar tab Unselected font color -->
<color name="sobot_postMsg_nav_tx_color">@color/sobot_white</color>
<!-- Leave message guide Hyperlink color -->
<color name="sobot_postMsg_url_color">@color/sobot_common_blue</color>
<!-- Leave message Upload image Popup Option background color -->
<color name="sobot_color_setting_item_pressed">@color/sobot_color_white</color>
<!-- Chat interface Button background color -->
<color name="sobot_btn_bg">@color/sobot_color</color>
<color name="sobot_btn_bg_pressed">@color/sobot_color</color>
<color name="sobot_btn_bg_disable">#EFF3FA</color>
<color name="sobot_text_btn_color">#ffffff</color>
<color name="sobot_text_btn_color_pressed">#80ffffff</color>
<!-- Delete history record Font color -->
<color name="sobot_text_delete_hismsg_color">@color/sobot_common_red</color>
<!-- Toast background color -->
<color name="sobot_color_toast_bg">#BF000000</color>
<!-- Product information Title color -->
<color name="sobot_goods_title_text_color">@color/sobot_color_text_first</color>
<!-- Product information Description color -->
<color name="sobot_goods_des_text_color">@color/sobot_color_text_second</color>
<!-- Product price color -->
<color name="sobot_goods_price_text_color">@color/sobot_color</color>
<!-- Order card General text color -->
<color name="sobot_order_label_text_color">@color/sobot_color_text_first</color>
<!-- Order card Order status color -->
<color name="sobot_order_status_text_color">#E67F17</color>
<!-- Order card Product description color -->
<color name="sobot_order_des_text_color">@color/sobot_color_text_third</color>
<!-- Leave message detail timeline line color -->
<color name="sobot_ticket_deal_line_grey">@color/sobot_color_line_divider</color>
<!-- Leave message Select service Font color -->
<color name="sobot_post_msg_template_text_color">@color/sobot_color</color>
<!-- Evaluation, Skill group, Switch service, Leave message popup Selection button selected background color -->
<color name="sobot_dialog_btn_select">@color/sobot_color</color>
<!-- Evaluation Thumbs down reason card Label button default text color -->
<color name="sobot_chat_lable_checkbox_text_color">@color/sobot_color_text_first</color>
<!-- Evaluation Submit button -->
<color name="sobot_evaluate_btn_press">@color/sobot_color</color>
<color name="sobot_evaluate_btn_nor">#4ADABE</color>
<!-- Ten-point evaluation (block) Selected color -->
<color name="sobot_ten_evaluate_select">#FA8314</color>
<!-- Five-star rating widget Corresponding description color -->
<color name="sobot_color_evaluate_ratingBar_des_tv">#FA8314</color>
<!-- Multi-round conversation Tag Font color -->
<color name="sobot_template2_lable_text_color">@color/sobot_color</color>
<!-- Multi-round conversation View details Font color -->
<color name="sobot_template4_more_text_color">@color/sobot_common_blue</color>
<!-- History Suggestion question color -->
<color name="sobot_color_suggestion_history">@color/sobot_color_text_first</color>
<!-- File message Send and download Button background -->
<color name="sobot_btn_normal_color">@color/sobot_color</color>
<!-- File progress bar foreground color -->
<color name="sobot_sectorProgressView_fgColor">#4D000000</color>
<!-- Semi-transparent -->
<color name="sobot_half_transparent">#73000000</color>
<!-- Auto-complete background color -->
<color name="sobot_auto_complete_press">@color/sobot_color_bg_second</color>
<color name="sobot_auto_complete">@color/sobot_color_transparent</color>
<!-- Custom card -->
<color name="sobot_card_goods_desc">@color/sobot_color_text_third</color>
<color name="sobot_card_goods_price">#FFFE7F02</color>
<!-- Border -->
<color name="sobot_card_mgs_bg">@color/sobot_white</color>
<color name="sobot_card_mgs_bg1">#fffdff</color>
<color name="sobot_card_mgs_bg2">#fbf8fb</color>
<color name="sobot_card_mgs_bg3">#f4f1f5</color>
<!-- Unread guide -->
<color name="sobot_readinfo_bg">@color/sobot_color_bg_third</color>
<!-- Ticket resolved status -->
<color name="sobot_ticket_resolved_text">#52C41A</color>
<color name="sobot_ticket_resolved_bg">#F2FFE6</color>
<!-- Ticket processing status -->
<color name="sobot_ticket_deal_text">#FA8314</color>
<color name="sobot_ticket_deal_bg">#FFF5E3</color>
<!-- Ticket pending reply status -->
<color name="sobot_ticket_reply_text">#2D85EC</color>
<color name="sobot_ticket_reply_bg">#E6F7FF</color>
<!-- Rating -->
<color name="sobot_evaluate_text_unselect">#B6BECB</color>
<color name="sobot_evaluate_text_select">@color/sobot_color_text_first</color>
<!-- Light green Rating tag button hollow background color -->
<color name="sobot_light_green">#E6F6F7</color>
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# 5.Set Night (Dark) Mode
After upgrading the SDK to V7 (4.3.0), this function is implemented through the background visitor-end settings, and the local method is removed.
/** Set the interface to day mode, night mode, or follow the system. Default is to follow the system.
* Set after SDK initialization, as it will reset after each initialization.
* @param mode 0 / AppCompatDelegate.MODE_NIGHT_AUTO: Switch between day/night themes based on current time
* 1 / AppCompatDelegate.MODE_NIGHT_NO: Day mode
* 2 / AppCompatDelegate.MODE_NIGHT_YES: Night mode
* Other / AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM: Follow the system
*
*/
ZCSobotApi.setLocalNightMode(context, int mode);
2
3
4
5
6
7
8
9
# ● Function Configuration Instructions
# 1. Customize the display time range for chat history
To set the user to only see chat records within xx days, you can call the following method:
/**
* Controls the time range for displaying historical chat records. It can show messages within 60 days at most, in minutes.
* If not passed, it will display all historical records by default.
* @param time Query time (example: 100 - represents sessions from 100 minutes ago)
*/
ZCSobotApi.setScope_time(context,time);
2
3
4
5
6
# 2. "+" Sign Panel Menu Expansion
After clicking the "+" button in the customer service chat interface, a menu panel will appear. You can add menus as needed. The code is as follows:
private void customMenu(){
//Add extended menu data
ArrayList<ChattingPanelUploadView.SobotPlusEntity> objects = new ArrayList<>();
/**
* SobotPlusEntity is a custom menu entity class
* @param iconResId Menu icon drawableId
* @param name Menu name
* @param action Menu action When the button is clicked, the corresponding action will be returned to the callback
* Use this as a basis to determine which button the user clicked
*/
objects.add(new ChattingPanelUploadView.SobotPlusEntity(R.drawable.sobot_camera_picture_button_selector, "Location", "action_location"));
objects.add(new ChattingPanelUploadView.SobotPlusEntity(R.drawable.sobot_camera_picture_button_selector, "Check-in", "action_sing_in"));
objects.add(new ChattingPanelUploadView.SobotPlusEntity(R.drawable.sobot_camera_picture_button_selector, "Favorite", "action_ollection"));
//Add data in both robot mode and human mode
//SobotUIConfig.pulsMenu.menus = objects;
//Add data only in human mode
SobotUIConfig.pulsMenu.operatorMenus = objects;
//Set callback
SobotUIConfig.pulsMenu.sSobotPlusMenuListener = new SobotPlusMenuListener() {
@Override
public void onClick(View view, String action) {
//Action corresponds to the action in the entity class
ToastUtil.showToast(getApplicationContext(), "action:"+action);
}
};
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 3. Sobot Log Display Switch
/**
* true shows log information, default is false not to show
*/
ZCSobotApi.setShowDebug(false);
2
3
4
# 4. Multi-language Support
Method 1:
Currently, the SDK supports multiple languages such as English and Chinese. The language will automatically switch and adapt based on the current phone language. If the current phone language is not recognized, Chinese will be used by default.
To add a new language package, put the supported language file into the corresponding language directory. For example: English path: sobotsdk/src/main/res/values-en/strings.xml.
Description: The language folder name is "values-" followed by the language identifier, such as values-en; the name of strings.xml remains unchanged.
Method Two,
《Customer SDK Supported Language Code Table》 (opens new window)
/**
* Specify the use of international language packages
* @param language Specify language code, for example: "zh-Hans": Simplified Chinese, "en": English, refer to "Customer SDK Supported Language Codes" for other language codes
* @param isUse Whether to use the specified language
*/
ZCSobotApi.setInternationalLanguage(context,language, isUse);
2
3
4
5
6
Special Handling:
If manual evaluation or robot evaluation tags are configured in multiple languages, multiple language display is not supported. You can hide the display through the following attributes (this does not affect the use of the evaluation function, only the tags are missing in the evaluation content).
// Hide evaluation labels when robot is hidden. Default is not hidden. True hides; false shows
info.setHideRototEvaluationLabels(false);
// Hide evaluation labels when manual mode is hidden. Default is not hidden. True hides; false shows
info.setHideManualEvaluationLabels(false);
2
3
4
5
# 5. Sobot partial feature page back button click monitoring (only records without interception), you can add your own logic (e.g., tracking)
ZCSobotApi.setFunctionClickListener(new SobotFunctionClickListener() {
@Override
public void onClickFunction(Context context, SobotFunctionType functionType) {
//1: Message return, 2: Conversation page return, 3: Help center return, 5: Call customer service
LogUtils.i(functionType.toString());
}
});
2
3
4
5
6
7
# 6. Security Verification
Function Location: Online Channel Settings - Channel Security Settings - Security Key Settings - Check "Effective Scope (APP)".
After enabling the "Security Key" function in the APP's effective scope, the SDK channel must pass the partnerid parameter. When integrating, add the parameters "sign" and "createTime". Here, sign = "MD5(app_key + partnerid + secret + createTime)", createTime is a Unix millisecond timestamp; secret is a 32-character string, and createTime is in milliseconds.
After passing parameters, Sobot will decrypt the sign and verify whether the passed partnerid matches the partnerid in the sign. If they match, the system will connect to Sobot normally. If they do not match, the connection will fail. If the customer does not pass the partnerid or sign, they will be considered an illegal user, and the connection will fail.
Turning on and off the "Security Key" feature in the APP takes effect immediately, and the scope of effectiveness is also applied in real time.
//Pass the following two parameters when launching the Sobot page
//Signature
info.setSign(your sign);
//Timestamp in milliseconds
info.setCreateTime(create_time);
2
3
4
5
# ● Information Class Description
# 1. ID Related
| Parameter | Type | Required | Description |
|---|---|---|---|
| app_key | String | Yes | Must be set, initialization will fail if not set |
| choose_adminid | String | No | Specify the customer service ID |
| tranReceptionistFlag | Integer | No | Specify the customer service transfer type, 0 can transfer to other customer service; 1 must transfer to the specified customer service |
| partnerid | String | No | Unique user identifier |
| robot_code | String | No | Robot ID for integration |
| robot_alias | String | No | Alias corresponding to the robot ID |
| faqId | String | No | FAQ parameter |
| sign | String | No | Signature MD5 encryption (app_key+partnerid+secret+create_time) |
| createTime | String | No | Timestamp |
# 2. Customer Service Workbench Display
| Parameter | Type | Required | Description |
|---|---|---|---|
| user_nick | String | No | Nickname |
| user_name | String | No | Real name |
| user_tels | String | No | User phone number |
| user_emails | String | No | User email |
| String | No | ||
| remark | String | No | Remark |
| face | String | No | User-defined avatar |
| visit_title | String | No | Title of the source page |
| visit_url | String | No | Source URL |
| params | String | No | User information |
| customer_fields | String | No | Custom fields with fixed keys |
| group_name | String | No | Skill group name |
| groupid | String | No | Skill group ID |
| isVip | String | No | Whether the customer is VIP |
| vip_level | String | No | VIP level |
| user_label | String | No | User label |
# 3. Conversation Page Related
| Parameter | Type | Required | Description |
|---|---|---|---|
| service_mode | Integer | No | Custom access mode: 1 Only robot, 2 Only human, 3 Intelligent customer service - Robot priority, 4 Intelligent customer service - Human priority |
# 4. Others
| Parameter | Type | Required | Description |
|---|---|---|---|
| transferaction | String | No | Transfer to agent, specify skill group overflow |
| summary_params | String | No | Custom fields for transferring to agent |
| multi_params | String | No | Custom fields for multi-round conversation |
| margs | String | No | Extended fields for hotspot guidance questions |
| content | String | No | Content of automatically sent product order information |
| queue_first | Boolean | No | Specify customer priority |
| isUseVoice | Boolean | No | Whether to use voice function. Default true, voice function can be used |
| isUseRobotVoice | Boolean | No | Whether the robot uses voice function. Default false, robot cannot use voice function and will convert to text |
| isShowLeftBackPop | Boolean | No | Whether a pop-up appears when returning from the top left corner (Are you ending the session?). Default false, no pop-up |
| isShowSatisfaction | Boolean | No | Whether a satisfaction evaluation pops up when clicking back on the navigation bar. Default false, pop-up, false does not show satisfaction |
| isShowCloseSatisfaction | Boolean | No | Whether a satisfaction evaluation pops up when closing the navigation bar button. Default false, pop-up, false does not show satisfaction. |
| equipmentId | String | No | Equipment ID |
| tranReceptionistFlag | Integer | No | Transfer type (0 - Can transfer to other agents, 1 - Must transfer to designated agent) |
| transferKeyWord | HashSet | No | Keywords for transferring to agent |
| isCloseInquiryForm | Boolean | No | Whether to close the pre-inquiry form |
| leaveMsgGuideContent | String | No | Message leaving guidance copy |
| leaveMsgGroupId | String | No | Message leaving skill group |
| leaveCusFieldMap | Map | No | Custom fields for message leaving |
| leaveParamsExtends | List | No | Integration fields |
| leaveTemplateId | List | No | Message leaving template ID |
| showLeaveDetailBackEvaluate | Boolean | No | Whether to pop up service evaluation window when returning in the message details interface |
| canBackWithNotEvaluation | Boolean | No | Temporary non-evaluation button when popping up the evaluation window |
| hideRototEvaluationLabels | Boolean | No | Whether to hide robot evaluation labels |
| hideManualEvaluationLabels | Boolean | No | Whether to hide manual evaluation labels |
| locale | String | No | Internationalization language for server-side interface |
| helpCenterTel | String | No | Add call telephone number in help center |
| helpCenterTelTitle | String | No | Help center telephone number button field |
| isShowRightMsgFace | Boolean | No | Whether to display avatar of right-side messages |
| isShowRightMsgNickName | Boolean | No | Whether to display nickname of right-side messages |
| isShowEveryLeftMsgFaceNickName | Boolean | No | Whether to display nickname and avatar for each left-side message |
# Source Code and Demo
Click to download Demo source code (opens new window);
Click to download the experience installation package (opens new window);
Click to view Demo usage tutorial (opens new window).
# Common Questions
FAQ:
Please click the link (opens new window) to enter the smart robot and input your question.
# Update Notes
# Sobot SDK Compliance Configuration Guide
Please refer to: <
Please inform users in the "Privacy Policy" about the use of the Sobot Customer Service SDK. Refer to the following terms:
SDK Name: Sobot Customer Service SDK
Service Type: Customer Service System
Types of Personal Information Collected: Device and system information (including operating system type, system version, APP package name, APP version, device type, device manufacturer, device model, network type), sensors (including accelerometer and proximity sensor), network identity information (IP address)
Privacy Policy Link: https://www.zhichi.com/docs/clause/sdk-clause.html
2
3
4
5
6
7