iOS SDK
# iOS SDK
Sobot SDK provides the enterprises with a full set of perfect intelligent agent solutions. Sobot SDK includes both agent business logic and interactive interface; With only two simple steps, enterprises can integrate Sobot in the APP, so that the APP has a 7 x 24 hour customer service capability.
Admins can add APP in 「 Home - Live Chat - Settings - Docking Channel Settings - Add Channel 」 in the backend, and then follow this access description to complete SDK docking.
Sobot SDK has the following features:
- Online inquiry: Inquire bot, inquire agent, submission, and Help Center.
- Designate the skill groups for reception.
- Guide users to make submissions when they are queuing or agents are not online.
- Under the bot first mode, the trans-to-agent button is hidden, and will be displayed when there are N bot unknown questions.
- Satisfaction evaluation: Users proactively make satisfaction evaluation + agents ask for evaluation when users exit.
- Pass user profile: User docking ID + basic profile + custom fields.
- Pass product source page: source page title + source page URL.
- Highly customized UI.
Related limits and notes:
iOS SDK new version supports version above iOS8, iPhone, iPad and supports both portrait mode and landscape mode.
The currently released XCode version is XCode 11.3.1. It is recommended to use the new version for development.
iOS currently only supports hyperlink tags and does not recognize other Html tags and attributes.
iOS requires MIC, camera, album and push permissions; otherwise, some functions are not available.
# File Introduction
# ● Schematic Diagram of Integration Process
# ● File Description
SDK files include (SobotKit.framework and SobotKit.bundle), SobotDemo, and Doc related documentation.
File | Description |
---|---|
SobotKit.framework | Sobot SDK code library |
SobotKit.bundle | SDK resource library, containing image files, multilingual files and colors |
ZCSobotApi.h | The file provides an access function (replace the previous ZCSobot.h) |
ZCLibInitInfo.h | Basic function param class (user info, reception mode, skill group, etc.) |
ZCKitInfo.h | Basic UI param class (color, control display/hide, etc.) |
ZCUIBaseController | UI superclass, all other pages inherit this controller |
ZCChatController | Chat interface |
SobotLocalizable.strings | Multi-language file, auto match the system language by default |
ZCLibClient.h | Global configuration class, mainly including non-UI related operation configurations |
# Integration Method
# ● Manual Integration
Download link: iOS_SDK (opens new window)
Unzip [iOS_SDK], and add necessary files SobotKit.framework and SobotKit.bundle to your project. The implementation of Sobot iOS_SDK depends on some system frameworks, which shall be added to the project when developing apps. Developers first click the project name on the right side of the project, then select TARGETS -> BuiLd Phases -> Link Binary With Libraries on the right side of the project name, expand LinkBinary With Libraries, and then click the "+" after expansion to add the following dependencies:
- AVFoundation.framework
- AssetsLibrary.framework
- AudioToolbox.framework
- SystemConfiguration.framework
- MobileCoreServices.framework
- WebKit.framework
# ● CocoaPods Integration
Add in podfile:
// Basic:
pod 'SobotKit'
// E-commerce:
pod 'SobotPlatform'
2
3
4
If you cannot find the latest version, run the following command to update the CocoaPods
pod repo update --verbose
If you cannot update to the latest version, you can delete the index file and try again
rm ~/Library/Caches/CocoaPods/search_index.json
2
3
4
Delete pod cache:
Delete the pod file folder in the code,
pod cache clean SobotKit
and then pod install
2
3
# Function Description
# ● Domain Name Settings
Domain name description:
Default SaaS platform domain name is: https:// api.sobot.com.
If you use the Tencent Cloud server, please set as: https:// ten.sobot.com.
If it's localized deployment, please use your deployed server domain name.
Sample code:
【Note: The domain name for SDK below 2.8.5 must be set before all API requests; that is, it must be set before initialization.】
// Setting method since SDK 2.8.5
// Set domain name during initialization; if it's not set, SaaS domain name is used by default
[ZCSobotApi initSobotSDK:@"your appkey" host:@"" result:^(id _Nonnull object) {
}];
// Use the following setting method for SDK 2.8.4 and below
// if([ZCLibClient getZCLibClient].libInitInfo == nil){
// [ZCLibClient getZCLibClient].libInitInfo = [ZCLibInitInfo new];
// }
// [ZCLibClient getZCLibClient].libInitInfo.api_host = @"host";
2
3
4
5
6
7
8
9
10
11
12
13
# ● Get Appkey
Get it by logging in to Sobot Management Platform (opens new window), as shown in the figure:
# ● Initialization
# 1. Basic:
Initialization params and call method: Initialization information and UI customization are divided into two models. Use ZCLibInitInfo to set function-related attributes and ZCKitInfo to set UI-related attributes, and pass them to the initialization method together. See the Demo call code for details;
The main call code is as follows:
【Note: Before initiating Sobot SDK, call the initialization API initSobotSDK; otherwise the SDK cannot be initiated.】
API:
// Setting method for SDK 2.8.5
// Set domain name during initialization; if it's not set, SaaS domain name is used by default
[ZCSobotApi initSobotSDK:@"your appkey" host:@"" result:(void (^)(id object))resultBlock;
/**
Use it since initializing Sobot SDK 2.7.2, use SaaS domain name by default
@param appkey Sobotapp_key(In case of E-commerce edition, fill in your company's app_key)
@param resultBlock Initialization result callback
*/
-(void)initSobotSDK:(NSString *) app_key result:(void (^)(id object))resultBlock;
2
3
4
5
6
7
8
9
10
11
12
Param:
Param | Type | Required | Description |
---|---|---|---|
app_key | NSString | Yes | app_key must be passed in. Support viewing in Backend -> Settings -> APP |
host | NSString | No | It's Alibaba Cloud domain name by default. If you want to use other domain names, you need to designate it. |
resultBlock | Block | Initialization status callback |
Sample code:
#import <SobotKit/SobotKit.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
NSLog(@"%@",[ZCSobot getVersion]);
// Error log collection (optional)
// [ZCLibClient setZCLibUncaughtExceptionHandler];
// Optional param setting
if([ZCLibClient getZCLibClient].libInitInfo == nil){
[ZCLibClient getZCLibClient].libInitInfo = [ZCLibInitInfo new];
}
// Initialization, must be executed and called before entering SDK
[[ZCLibClient getZCLibClient] initSobotSDK:@"your app_key" result:^(id object) {
NSLog(@"init %@",object);
}];
return YES;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 2. E-commerce
Initialization params and call method: Initialization information and UI customization are divided into two models. Use ZCLibInitInfo to set function-related attributes and ZCKitInfo to set UI-related attributes, and pass them to the initialization method together. See the Demo call code for details.
The main call code is as follows:
【Note: Before initiating Sobot SDK, call the initialization API initSobotSDK; otherwise the SDK cannot be initiated. Multiple executions do not call the API repeatedly.】
API:
Sample code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
NSLog(@"%@",[ZCSobot getVersion]);
// Error log collection (optional)
// [ZCLibClient setZCLibUncaughtExceptionHandler];
// Optional param setting
if([ZCLibClient getZCLibClient].libInitInfo == nil){
[ZCLibClient getZCLibClient].libInitInfo = [ZCLibInitInfo new];
}
[ZCLibClient getZCLibClient].libInitInfo.platform_key = @"private key"
// customer_code Merchant docking ID (E-commerce only. In case of no app_key, it must be provided)
// [ZCLibClient getZCLibClient].libInitInfo.customer_code = @"id"
// Add Platform identifier (it's required for E-commerce)
[ZCLibClient getZCLibClient].platformUnionCode = @"unit ID";
// Initialization
// If necessary, please set the domain name before initialization; otherwise the initialization API will fail
[ZCSobotApi initSobotSDK:@"your app_key" host:@"" result:^(id object) {
}];
return YES;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 3. Permission setting
Permissions to be added
<key>NSCameraUsageDescription</key>
<string>Your camera will be accessed to send photos</string>
<key>NSLocalizedDescription</key>
<string>Use push service</string>
<key>NSMicrophoneUsageDescription</key>
<string>Your MIC will be accessed to send voice messages</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Your photos will be accessed to send photos</string>
2
3
4
5
6
7
8
# ● Initiate Sobot Page
# 1. Initiate agent page
Basic and E-commerce editions have the same initiation method .
【 Note: For E-commerce, you have to re-designate merchant app_key, and reset app_key of the merchant to be initiated .】
API
/// Initiate chat page, simply processing
/// @param info Custom UI attribute
/// @param byController Initiated page
/// @param pageClick Current page status
+ (void)openZCChat:(ZCKitInfo *) info
with:(UIViewController *) byController
pageBlock:(void (^)(id object,ZCPageBlockType type))pageClick;
// messageLinkClick Link click event
+(void)setMessageLinkClick:(BOOL (^)(NSString * _Nonnull))messagelinkBlock
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Param
Param | Type | Required | Description |
---|---|---|---|
info | ZCKitInfo | Yes | Custom setting of initialization params |
byController | UIViewController | Yes | VC for executing jump |
delegate | ZCChatControllerDelegate | No | Chat page delegate, to implement jump from submission to the custom page |
pageClick | Block | No | Callback upon clicking Back |
messagelinkBlock | Block | No | Click the message link for callback, return YES for processing, and return NO for not processing. You can set it to nil. If this is not nil, the value of setMessageLinkClick will be overwritten, and the value set later will overwrite the value set earlier |
Sample code:
// Set params required to be passed. All params in ZCLibInitInfo can be reset
ZCLibInitInfo *initInfo = [ZCLibClient getZCLibClient].libInitInfo;
// Set the user ID as the unique basis for identifying the user (do not set fixed values such as 123456, 0, 000000, etc.; otherwise the chat history of the same ID will be the same). If not set, a unique identifier will be generated by default according to the mobile phone certificate, with a maximum of 300 characters, and the excess part will be automatically intercepted
initInfo.partnerid = @"";
// For E-commerce, you have to redesignate the merchant app_key or merchant code customer_code
// initInfo.app_key = @"";
// Deassign
[ZCLibClient getZCLibClient].libInitInfo = initInfo;
// Configure UI
ZCKitInfo *uiInfo=[ZCKitInfo new];
// Such as setting navigation bar color
uiInfo.topViewBgColor = [UIColor redColor];
// [Note: For initialization method since SDK 2.7.0, messageLinkClick is accompanied by Bool return value, true: Processing, false: Not processing]
// target If the passed param is not nil, it's required to implement -(void)openLeaveMsgClick:(NSString*)tipMsg; Delegate method Submission jumps to the user custom submission page
[ZCSobotApi openZCChat:uiInfo with:self target:nil pageBlock:^(id object, ZCPageBlockType type) {
// Click Back
if(type==ZCPageBlockGoBack){
// NSLog(@"click close");
}
// After completing page UI initialization, you can get UIView and customize UI
if(type==ZCPageBlockLoadFinish){
}
} messageLinkClick:^(NSString *link) {
NSLog(@"%@",link);
// When receiving link = sobot:// sendlocation, call Sobot API to send location information
// When receiving link = sobot:// openlocation?latitude=xx&longitude=xxx&address=xxx, you can handle relevant business according to your own situation
if( [link hasPrefix:@"sobot:// sendlocation"]){
// Send coordinate point
NSString *fullPath = GetDocumentsFilePath(fname);
[imageData writeToFile:fullPath atomically:YES];
// Send location information
[ZCSobot sendLocation:@{
@"lat":@" 40.001693 ",
@"lng":@" 116.353276 ",
@"localLabel":@"address",
@"localName":@"title",
@"file":fullPath}];
return YES;
}else if([link hasPrefix:@"sobot:// openlocation"]){
// Parse longitude, latitude, address: latitude=xx&longitude=xxx&address=xxx
// Jump to the map location
NSLog(link);
// Test to open map Amap Web
NSString * urlString = @"";
urlString = [[NSString stringWithFormat:@"http:// uri.amap.com/marker?position=%f,%f&name=%@&coordinate=gaode&src=%@&callnative=0",@116.353276,@40.001693,@"address",@"title"] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:urlString]];
return YES;
}
return NO;
}];
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
# 2. Initiate merchant list (E-commerce)
【Note: Initiate merchant list (only supported for E-commerce)】
API
// For SDK 2.8.5
+ (void)openZCChatListView:(ZCKitInfo *)info with:(UIViewController *)byController onItemClick:(void (^)(ZCUIChatListController *object,ZCPlatformInfo *info))itemClickBlock;
2
3
4
Param
Param | Type | Required | Description |
---|---|---|---|
info | ZCKitInfo | Yes | Set UI-related custom params |
byController | UIViewController | Yes | VC for executing jump |
delegate | ZCChatControllerDelegate | No | Chat page delegate, to implement jump from submission to the custom page |
pageClick | Block | No | Callback upon clicking Back |
itemClickBlock | Block | No |
Sample code:
// New method
[ZCSobotApi openZCChatListView:info with:byController onItemClick:itemClickBlock];
// Directly initiate merchant list page, which is the method for SDK below 2.8.4. New method is recommended
[ZCSobot startZCChatListView:uiInfo with:self onItemClick:nil];
// Initiate merchant list, but it may be required to re-configure params upon clicking a merchant, and process jump by yourself. This is the method for SDK below 2.8.4. New method is recommended
[ZCSobotApi openZCChatListView:uiInfo with:self onItemClick:^(ZCUIChatListController *object, ZCPlatformInfo *info) {
// Once a merchant's click event triggers it, it will automatically initiate Sobot chat page. Params required to be passed can be modified. All params in ZCLibInitInfo can be reset
[ZCLibClient getZCLibClient].libInitInfo.app_key = info.app_key;
[ZCSobotApi openZCChat:[ZCGuideData getZCGuideData].kitInfo with:self pageBlock:^(id _Nonnull object, ZCPageBlockType type) {
}];
}];
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 3. Initiate Help Center
ZCKitInfo *kitInfo = [ZCKitInfo new];
// kitInfo.helpCenterTel = @"40012345678";
// kitInfo.helpCenterTelTitle = @"400-tel";
// Open Help Center page
+ (void)openZCServiceCenter:(ZCKitInfo *) info
with:(UIViewController *) byController
onItemClick:(void (^)(ZCUIBaseController *object))itemClickBlock;
2
3
4
5
6
7
8
9
10
Sketch:
# ● End Chat
/// Disable the channel, clear up memory, and log out of Sobot system Delete push
///@ param unregisterToken YES Close push; NO offline users, but can receive push push notifications
///@ param reason offline reason (please fill it out carefully, do not display it, only conduct offline analysis of later anomalies)
+ (void)outCurrentUser:(BOOL) unRegisterToken reason:(NSString *) reason;
2
3
4
5
6
7
# ● Chatbot
# 1. Dock with the designated bot
Get the bot no. at backend:
Configure in SDK codes:
ZCLibInitInfo *initInfo = [ZCLibClient getZCLibClient].libInitInfo;
libInitInfo.robotid = @"robotID";
// If no bot alias is set, designation will be invalid. Note: If you designate any alias, you have to set robotid to null; otherwise when the alias is incorrect, the last default value will be used
libInitInfo.robot_alias = @"robot alias";
2
3
4
5
6
Note: If it's not set, the default value will be used.
# 2. Customize access mode
As per business requirements, you can configure the following initialization params to control access mode:
ZCKitInfo *uiInfo=[ZCKitInfo new];
// Whether to enable voice function ON by default
kitInfo.isOpenRecord = @"YES";
// Whether to enable bot voice (paid service, or otherwise voice cannot be recognized)
kitInfo.isOpenRobotVoice = @"YES";
// Whether to display trans-to-agent button
kitInfo.isShowTansfer = @"YES";
// No. of bot unknown replies
kitInfo.unWordsCount = @"1";
// Whether to enable intelligent trans-to-agent (e.g., when entering "trans-to-agent", directly transfer to agent)
If you need to hide the trans-to-agent button, refer to isShowTansfer and unWordsCount attributes
kitInfo.isOpenActiveUser = @"YES";
// Intelligent trans-to-agent keywords, keywords are key{@"trans-to-agent",@"1",@"R":@"1"}
kitInfo.activeKeywords = @{@"Transfer customer service":@"",@"R":@"",@"r":@""};
// Customize Reception Mode
Note: After local setting, the local reception mode will be used first
The PC reception mode will no longer work. But the PC one is recommended
PC setting
0: Follow the system setting (default)
1: Bot only
2: Agent only
3: Intelligent agent - bot only
4: Intelligent agent - agent only
libInitInfo.service_mode = 4;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 3. Customize trans-to-agent event
Method of customizing trans-to-agent event:
-(void)turnServiceWithGroupId:(NSString *)groupId Obj:(id)obj Msg:(NSString*)msg KitInfo:(ZCKitInfo*)uiInfo ZCTurnType:(NSInteger)turnType Keyword:(NSString*)keyword KeywordId:(NSString*)keywordId
Param description:
groupId Pass skill group ID
obj Trans-to-agent param
msg Trans-to-agent info
uiInfo Configure product info and auto sending param
turnType Trans-to-agent event type (button trigger, keyword trigger, etc)
keyword Keyword
keywordId Keyword ID
【Note: If this method is implemented, the SDK trans-to-agent events will be handled by external controller. You can jump to the skill group page designed by yourself, or switch product information, etc. SDK will no longer execute any trans-to-agent operation. You need to call the trans-to-agent API turnServiceWithGroupId: to implement the specific trans-to-agent operation.】
Customize trans-to-agent callback event:
Intercept SDK trans-to-agent events to jump to your own APP page for dynamic trans-to-agent processing Configure params like skill group ID and product info
@property (nonatomic,strong) TurnServiceBlock turnServiceBlock;
Sample code:
[ZCLibClient getZCLibClient].turnServiceBlock = ^(id obj,NSString *msg,NSInteger turnType, NSString *keyword ,NSString *keywordId) {
// Customize product info
// ZCProductInfo *productInfo = [ZCProductInfo new];
// productInfo.thumbUrl = @"goodsURL";
// productInfo.title = @"goodstitle";
// productInfo.desc = @"desc";
// productInfo.label = @"label";
// productInfo.link = @"http:// www.sobot.com";
// uiInfo.productInfo = productInfo;
// uiInfo.isSendInfoCard = YES;// Whether to auto send the product card info after trans-to-agent
[[ZCLibClient getZCLibClient] turnServiceWithGroupId:@"group_id" Obj:obj Msg:msg KitInfo:uiInfo ZCTurnType:turnType Keyword:keyword KeywordId:keywordId];
};
2
3
4
5
6
7
8
9
10
11
12
# 4. Trans-to-agent overflow setting
In SDK, you can set trans-to-agent designated skill group overflow
Sample code:
/**
* Trans-to-agent Designated skill group Overflow
*
Param Description
actionType Execution action type:
to_group Designated skill group;
to_service Designated agent.
deciId Designated skill group or agent id
optionId Overflow tag
1: Overflow; when designating an agent
2. Non-overflow; when designating an agent
3: Overflow; when designating a skill group
4: Non-overflow; when designating a skill group
spillId overflow conditions
1: Agent Offline; when designating an agent
2: Agent occupied; when designating an agent
3: Intelligent judgement; when designating an agent
4: No agent online in the skill group; when designating an agent group
5: All agents occupied in the skill group; when designating an agent group
6: The skill group off-duty; when designating an agent group
7: Intelligent judgement; when designating an agent group
[{"actionType":"to_group","optionId":"3","deciId":"162bb6bb038d4a9ea018241a30694064","spillId":"7"},{"actionType":"to_group","optionId":"4","deciId":"a457f4dfe92842f8a11d1616c1c58dc1"}]
actionType: Execution action type:
to_group: Transfer to the designated skill group
optionId: Whether to overflow when designating a skill group: 3: Overflow, 4: Not overflow
deciId: Designated skill group.
spillId overflow conditions When designating an agent group: No agent online in the skill group ,5: Skill Group all,6: Skill Group ,7:smart
Set 4 groups max in the array, overflow by turn
*/
ZCLibInitInfo *initInfo = [ZCLibClient getZCLibClient].libInitInfo;
initInfo.transferaction = @[@{@"actionType":@"to_group",@"optionId":@"3",@"deciId":@"a890849f552b4b69b4a027db4e9a1880",@"spillId":@"4"},@{@"actionType":@"to_group",@"optionId":@"3",@"deciId":@"5600aa6786f34629a7484819b8132c3a",@"spillId":@"4"}];
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
# 5. Hide buttons in the "+" menu bar
Pass relevant fields in ZCKitInfo
eg:
ZCKitInfo *kitInfo=[ZCKitInfo new];
// Function in the "+" at the bottom of chat page: Hide evaluation, NO (not hide) by default
kitInfo.hideMenuSatisfaction = YES;
// Function in the "+" at the bottom of chat page: Hide submission, NO (not hide) by default
kitInfo.hideMenuLeave = YES;
2
3
4
5
6
7
8
# 6. Designate bot guidance text
You can set different bot guidance texts for different scenarios
Pass relevant fields in ZCKitInfo
eg:
ZCLibInitInfo *_libInitInfo [ZCLibClient getZCLibClient].libInitInfo;
_libInitInfo.faqId = 24;
2
3
4
5
6
# ● Agent
# 1. Dock with the designated skill group
Get the skill group no. in the backend:
Configure skill group ID in SDK codes:
ZCLibInitInfo *initInfo = [ZCLibClient getZCLibClient].libInitInfo;
initInfo.groupid = @"groupID";
2
【Note: This field is optional. If a skill group ID is passed in, it will not pop up skill group selection box after trans-to-agent in SDK; it will directly jump to the skill group corresponding to the passed ID.】
# 2. Dock with the designated agent
Get the designated agent ID in the backend:
Configure in SDK codes:
ZCLibInitInfo *initInfo = [ZCLibClient getZCLibClient].libInitInfo;
libInitInfo.choose_adminid = @"adminID";
libInitInfo.tran_flag = @"0";
2
3
【Note: choose_ adminid: Designate the agent for docking. If it is not set, the default shall apply. tran_flag: Whether to transfer to the designated agent alone after designating any agent, 0: Transfer to any agent, 1: Transfer to the designated agent alone. If it's set to 1, when the designated agent is offline, it cannot transfer to other agents.】
# 3. Set user custom profile and fields
Developers can directly pass these user data for agents to view.
When configuring fields to be displayed at the console, refer to the configuration method below:
Fixed key custom field
// Set user custom fields
- (void)customUserInformation:(ZCLibInitInfo*)libInitInfo{
libInitInfo.customer_fields = @{@"customField22":@"value1",
@"userSex":@"value1",
@"weixin":@"value1",
@"weibo":@"value1",
@"birthday":@"2017-06-08"};
}
2
3
4
5
6
7
8
User custom profile, custom key:
// User custom profile
libInitInfo.params = @{@"key":@"value1"};
2
3
Sketch:
# 4. Set auto message sending after transfer
// Send message automatically
ZCLibInitInfo *initInfo = [ZCLibClient getZCLibClient].libInitInfo;
// 0: Not send 1: Send to bot 2: Send to agent 3: Send to both bot and agent
initInfo.good_msg_type = 1;
// If the message is non-text, pass the local path
initInfo.content = @"123";
// Content type, 0, // Text 1, // Photo 12, // File // Video
initInfo.auto_send_msgtype = 0;
/// Send message to agent
/// @param textMsg If the message content is video, image, audio or file, please pass the local path
/// @param msgType 0, // Text 1, // Photo 12, // File 23, // Video
/// @param ResultBlock Sending result code == 0 indicates Sent
+ (void)sendMessageToUser:(NSString *)textMsg type:(NSInteger ) msgType resultBlock:(nonnull void (^)(NSString *, int code))ResultBlock;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 5. Set the designated customer to be received first in queue
SDK can configure the current user to queue first. When entering the queue, the user will be received first.
// Same as PC Settings - Live Chat Assignment - Queue Priority Setting - Designated Customer First Enable passing 1 Not set by default
@property(nonatomic,assign) int queue_first;
2
# 6. Set custom service summary fields
initInfo.summary_params = @{@" customField15615315349481 ":@" Field value1",@" customField15615315349482 ":@" Field value2"};
# 7. Configure multi-round chat API params
When using the multi-round chat function, we will pass uid and mulitParams, two fixed custom params, for each API. uid is the user's unique ID, and mulitParams is the json string of the custom fields. If the user has docked these two fields, we will return these two fields to the third-party API. If not, we will pass a null field.
initInfo.multi_params = @{@"customField15619769556831":@"showxxyyyzzz1032"};
# 8. Product Card
It's the product inquiry information and supports directly sending the message card only in agent mode. Configure the following information in ZCKitInfo. h, and pass it in when initiating the page:
/**
* Whether to automatically send product card information (After trans-to-agent is done, automatically send product card information)
* Disable by default After enabling, send only once in a valid chat by default
**/
@property (nonatomic,assign) BOOL isSendInfoCard;
/*
Whether to send product information automatically every time (send product card information automatically after trans-to-agent)
It's required to enable isSendInfoCard = YES
(New function for SDK 3.0.3)
*/
@property (nonatomic,assign) BOOL isEveryTimeSendCard;
// Product customization class ZCProductInfo If you want to add product information, please add the following information. The title "title" and page URL "link" are required fields. If you do not add product information, it will not be displayed on the page.
ZCProductInfo *productInfo = [ZCProductInfo new];
// thumbUrl Thumbnail URL
productInfo.thumbUrl = @"thumbUrl";
// title Title (required)
productInfo.title = @"title";
// desc Digest
productInfo.desc = @"desc";
// label Label
productInfo.label = @"label";
// Page URL (required)
productInfo.link = @"goodsurl";
kitInfo.productInfo = productInfo;
// Manually call to directly send product card
ZCProductInfo *productInfo = [ZCProductInfo new];
productInfo.thumbUrl = @"thumbUrl";
productInfo.title = @"title";
productInfo.desc = @"desc";
productInfo.label = @"label";
productInfo.link = @"link";
[ZCSobotApi sendProductInfo:productInfo resultBlock:nil];
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
Sketch:
# 9. Order card
In SDK, you can send custom order information only in agent mode. If you have such requirement, you can use the following setting method:
Configure button:
ZCKitInfo *kitInfo=[ZCKitInfo new];
NSMutableArray *arr = [[NSMutableArray alloc] init];
ZCLibCusMenu *menu1 = [[ZCLibCusMenu alloc] init];
menu1.title = [NSString stringWithFormat:@"order"];
menu1.url = [NSString stringWithFormat:@"sobot:// sendOrderMsg"];;
menu1.imgName = @"zcicon_sendpictures";
[arr addObject:menu1];
kitInfo.cusMoreArray = arr;
2
3
4
5
6
7
8
Simulate customizing "+" click sending event:
Return YES to indicate intercepting event, which will be manually processed by the user; Return NO to indicate not intercepting event, which will be processed by Sobot SDK
[ZCSobotApi setMessageLinkClick:^BOOL(NSString *linkUrl) {
if ([linkUrl hasPrefix:@"sobot:// sendOrderMsg"]){
ZCOrderGoodsModel *model = [ZCOrderGoodsModel new];
model.orderStatus = 0; // New param, 0 is custom status, displaying statusCustom content
model.statusCustom = @"custom state";
model.createTime = [NSString stringWithFormat:@"%.0f",[[NSDate date] timeIntervalSince1970]*1000];
model.goodsCount = @"3";
model.orderUrl = @"https:// www.sobot.com";
model.orderCode = @" 1000234242342345 ";
model.goods =@[@{@"name":@"goodsName",@"pictureUrl":@"http:// pic25.nipic.com/20121112/9252150_150552938000_2.jpg"},@{@"name":@"goodsName",@"pictureUrl":@"http:// pic31.nipic.com/20130801/11604791_100539834000_2.jpg"}];
// When it is displayed, it will be divided by 100 (two decimal places), such as 48.90
model.totalFee = @"4890";
[ZCSobotApi sendOrderGoodsInfo:model resultBlock:nil];
return YES;
}
return NO;
}];
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
ZCOrderGoodsModel class description:
/**
Send order message fields:
Order status: orderStatus
Order no.: orderCode
Order creation time: createTime
Product image link: goodsPicturesUrls
Order link: orderUrl ,
Product description: goodsDesc
Product count: goodsCount
Total amount: totalFee, displayed with two decimal places by default. E.g.: When passing 4890, it will be displayed as 48.90
*/
/*
Custom: 0, display statusCustom content
To be paid: 1 ,
To be delivered: 2 ,
On the way: 3 ,
Delivering: 4 ,
Finished: 5 ,
To be evaluated: 6 ,
Canceled: 7 ,
Other: Not in code
*/
@property (nonatomic,assign) int orderStatus;
// Customize order status display content. It takes effect only when orderStatus=0
@property (nonatomic,strong) NSString *statusCustom;
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
Sketch:
# 10. Check if merchant agent is chatting with a user (E-commerce only)
/**
*
* Obtain if the corresponding merchant agent is chatting with a user (The e-commerce version is used)
* appkey: merchant id uid: uid in ZCPlatformInfo class
**/
+(BOOL)getPlatformIsArtificialWithAppkey:(NSString *)appkey Uid:(NSString*)uid;
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
ZCPlatformInfo *info = [_listArray objectAtIndex:indexPath.row];
[ZCSobotApi getPlatformIsArtificialWithAppkey:info.appkey Uid:info.uid];
}
2
3
4
5
6
7
8
9
10
11
# 11. Set VIP level and user tag
/**
*
* Designate whether the customer is VIP, 0: General 1: VIP
* Same as PC Settings - Live Chat Assignment - Queue Priority Setting - VIP Customer Queue First Enable passing 1 Not set by default
* After enabling, when the designated customer initiates an inquiry, in case of queuing, the system will receive the customer first.
**/
@property (nonatomic,copy) NSString *isVip;
/**
*
* Designate the customer's VIP level, and pass a level
* Same as PC Settings - Custom Fields - VIP Level, get the ID or name corresponding to the level
**/
@property (nonatomic,copy) NSString *vip_level;
/**
*User tag. Multiple fields are separated by comma;
User tag can be edited in the Sobot admin terminal (System Settings > Custom Fields > Customer Fields) to get the ID or name corresponding to the user tag
**/
@property (nonatomic,copy) NSString *user_label;
Pass relevant fields in ZCLibInitInfo
eg:
ZCLibInitInfo *libInitInfo = [ZCLibClient getZCLibClient].libInitInfo;
// Set VIP level by name
libInitInfo.vip_level = @"level1";
// You can add two or more user tags and separate these tag IDs or names by comma ","
libInitInfo.user_label = @"vip,vip2";
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
# 12. After trans-to-agent, hide buttons in the "+" menu bar
Pass relevant fields in ZCKitInfo
eg:
ZCKitInfo *kitInfo=[ZCKitInfo new];
// Function in the "+" at the bottom of chat page: Hide evaluation, NO (not hide) by default
kitInfo.hideMenuSatisfaction = YES;
// Function in the "+" at the bottom of chat page: Hide submission (bot and agent), NO (not hide) by default
kitInfo.hideMenuLeave = YES;
// Function in the "+" at the bottom of chat page: Hide submission (agent only), NO (not hide) by default
kitInfo.hideMenuManualLeave = YES;
// Function in the "+" at the bottom of chat page: Hide photos, NO (not hide) by default
kitInfo.hideMenuPicture = YES;
// Hide camera, NO (not hide) by default
kitInfo.hideMenuCamera = YES;
// Hide files, NO (not hide) by default
kitInfo.hideMenuFile = YES;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# ● About Submission Ticket
# 1. Set submission interface at the console
You can set submission interface at the console
Hide submission function in SDK
// Function in the "+" at the bottom of chat page: Hide submission (bot and agent), NO (not hide) by default
kitInfo.hideMenuLeave = YES;
// Function in the "+" at the bottom of chat page: Hide submission (agent only), NO (not hide) by default
kitInfo.hideMenuManualLeave = YES;
2
3
4
5
6
# 2. Configure custom user info on the submission page
The verification and display logic of email, phone no. and attachment parameters in the submission can be configured on the PC console page.
# 3. Jump to the submission page
User can directly jump to the submission page:
ZCKitInfo *kitInfo = [[ZCKitInfo alloc] init];
kitInfo.leaveContentPlaceholder = @"holder";
kitInfo.leaveMsgGuideContent = @"tips";
NSMutableArray *customField = [[NSMutableArray alloc] init];
[customField addObject:@{@"id" : @" 510fb45d6e9d4a9c99a7c24861d584d7 ", @"value" : @" ca55f29ed5dd4879bdf3ab213fec3381 "}];
[customField addObject:@{@"id" : @" 6ee93dd945ac47fcac1a80bf03fd23fd ", @"value" : @" 6ee93dd945ac47fcac1a80bf03fd23fd "}];
[customField addObject:@{@"id" : @" abd0229cd5a64798b74516b3f09bbd7e ", @"value" : @" abd0229cd5a64798b74516b3f09bbd7e "}];
kitInfo.leaveCusFieldArray = [customField copy];
// When entering submission-ticket transfer page, docking field is required
kitInfo.leaveParamsExtends = @[@{@"id":@"d93847a05710483893fd2d05e16a2b82",@"params":@"msgid",@"value":@"testdata"}];
kitInfo.leaveMsgGroupId = @" 540a910a760f4387918b0fa7302a0eca ";
[ZCSobotApi openLeanve:0 kitinfo:kitInfo with:self onItemClick:^(NSString *msg, int code) {
}];
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Relevant params:
/**
Customize submission content preset text. If you need to translate it into another language, you can take the text as key for translation in bundle file
E.g.: "Please enter the content"="Please enter content";
*/
@property (nonatomic,strong) NSString *leaveContentPlaceholder;
/**
Customize submission guidance text. If you need to translate it into another language, you can take the text as key for translation in bundle file
E.g.: "Can't answer your question, you can leave a message"="Please leave";
*/
@property (nonatomic,strong) NSString *leaveMsgGuideContent;
/**
* Directly enter the submission custom field
* Array, which can be passed in multiple
* id: Customize field ID
* value: Data to be passed
* @{@"id":@"",@"value":@"the test data"}
**/
@property (nonatomic,strong) NSMutableArray * leaveCusFieldArray;
/**
* When entering submission-ticket transfer page, docking field is required
* Array, which can be passed in multiple
* id: Docking field ID auto generated by the system
* value: Data to be passed
* params: Displayed field ID, such as city, address, corresponding to ID
* @{@"id":@"textfield12",@"value":@"the test data",@"params":@"city"}
**/
@property (nonatomic,strong) NSMutableArray * leaveParamsExtends;
/**
Submission skill group ID
Location: Settings —> Ticket Skill Group Setting
*/
@property (nonatomic,strong) NSString * leaveMsgGroupId;
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
# 4. Submission page event interception
In SDK, submission can jump to the custom page. If you require it, you can configure by the following method:
Comply with ZCChatControllerDelegate protocol when initiating VC
In the initiation method, pass target (delegate) to initiate VC
[ZCSobotApi openZCChat:uiInfo with:self target:vc pageBlock:^(ZCChatController *object, ZCPageBlockType type) {
} messageLinkClick:^(NSString *link) {
}];
Delegate implementation method:
-(void)openLeaveMsgClick:(NSString*)tipMsg{
// Click submission delegate event
NSLog(@"tipMsg ==%@",tipMsg);
}
2
3
4
5
6
7
8
9
10
# 5. Ticket reply button
You can set whether to display submission button by param configuration:
/**
* After submission is done, whether to display Reply button
* YES by default, you can reply
*/
@property (nonatomic,assign) BOOL leaveCompleteCanReply;
2
3
4
5
# 6. Get the latest submission reply
/// Get the latest reply
/// @param partnerid User ID
/// @param ResultBlock code=1 Returned,
/// dict :data:items:[{(ticketId(Ticket ID),ticketTitle(Ticket Title),replyContent(Reply Content),replyTime(Reply Time),customerId(Customer ID),serviceNick(Agent Nickname)}]
+ (void)getLastLeaveReplyMessage:(NSString *) partnerid resultBlock:(void (^)(NSDictionary *dict,NSMutableArray *arr,int code))ResultBlock;
Sample code
[ZCSobotApi getLastLeaveReplyMessage:[ZCLibClient getZCLibClient].libInitInfo.partnerid resultBlock:^(NSDictionary * _Nonnull dict, NSMutableArray * _Nonnull arr, int code) {
if(arr!=nil && arr.count > 0){
ZCRecordListModel *model = [arr firstObject];
// Notification params
NSString *identifier = [NSString stringWithFormat:@"leavereply.www.sobot.com%f",[[NSDate date] timeIntervalSinceNow]];
NSDictionary *userInfo = @{@"msgfrom":@"sobot",@"pushType":identifier,
@"ticketId":model.ticketId
};
NSTimeInterval time = [model.replyTime doubleValue]/1000; // If the passed timestamp str is accurate to millisecond, remember to /1000
NSDate *detailDate = [NSDate dateWithTimeIntervalSince1970 :time];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; // Instantiate an NSDateFormatter object
// Set the time format you want
[dateFormatter setDateFormat:@"MM-dd HH:mm"];
NSString *currentDateStr = [dateFormatter stringFromDate:detailDate];
NSString *replyContent = model.replyContent;
replyContent = [replyContent stringByReplacingOccurrencesOfString:@"<p>" withString:@""];
replyContent = [replyContent stringByReplacingOccurrencesOfString:@"</p>" withString:@""];
replyContent = [replyContent stringByReplacingOccurrencesOfString:@"<br/>" withString:@""];
NSString *replyStr = [NSString stringWithFormat:@"%@\n %@ \n %@",model.ticketTitle,currentDateStr,replyContent];
[ZCSobotApi postLocalNotification:replyStr dict:userInfo];
}
}];
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
# 7. Add submission evaluation active reminder ON/OFF button
Pass relevant fields in ZCKitInfo
eg:
ZCKitInfo *kitInfo=[ZCKitInfo new];
// Completed submission details interface:Whether to pop up the service evaluation window upon clicking Back (it will only pop up for the first time, and will not pop up again next time)
// NO by default, not actively remind
kitInfo.showLeaveDetailBackEvaluate = YES;
2
3
4
5
6
7
# 8. Add submission extension params
Pass relevant fields in ZCKitInfo, field description;
/**
* Directly enter the submission custom field
* Array, which can be passed in multiple
* id: Customize field ID
* value: Data to be passed
* @{@"id":@"",@"value":@"test data"}
**/
@property (nonatomic,strong) NSMutableArray * leaveCusFieldArray;
/**
* Directly enter the submission docking field
* Array, which can be passed in multiple
* id: Docking field ID auto generated by the system
* value: Data to be passed
* params: Displayed field ID, such as city, address, corresponding to ID
* @{@"id":@"textfield12",@"value":@"test data",@"params":@"city"}
**/
@property (nonatomic,strong) NSMutableArray * leaveParamsExtends;
/**
Submission skill group ID
Location: Settings —> Ticket Skill Group Setting
*/
@property (nonatomic,strong) NSString * leaveMsgGroupId;
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
# ● Evaluation
# 1. Set evaluation interface
You can set satisfaction evaluation interface at the console
# 2. Evaluation-related configuration
/**
*
* Whether to display Evaluation button on the top right corner of the navigation bar Not display by default
*
**/
@property (nonatomic,assign) BOOL isShowEvaluation;
/**
*Whether to display Close button in the top right corner of the navigation bar. Not display by default. After clicking Close button, the backend messages cannot be monitored
**/
@property (nonatomic,assign) BOOL isShowClose;
/**
*
* Separately set whether to display the evaluation interface for the Close button. Not display by default
*
**/
@property (nonatomic,assign) BOOL isShowCloseSatisfaction;
/**
* Whether to close the chat after agent evaluation (release the chat after agent satisfaction evaluation).
* NO (OFF) by default
*
*/
@property (nonatomic,assign) BOOL isCloseAfterEvaluation;
/**
* Whether to turn on satisfaction evaluation upon clicking Back
* NO (OFF) by default
*
*/
@property (nonatomic,assign) BOOL isOpenEvaluation;
/**
* Turn on satisfaction evaluation when clicking Back and display Not Evaluate Now button
* NO (OFF) by default
*/
@property (nonatomic,assign) BOOL canBackWithNotEvaluation;
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
Reference effect:
# 3. Require users to evaluate upon clicking Back or Close
// Whether to turn on satisfaction evaluation upon clicking Back or Close. NO (OFF) by default
kitInfo.isOpenEvaluation = YES;
// Whether to close the chat after agent evaluation (release the chat after agent satisfaction evaluation). NO (OFF) by default
kitInfo.isCloseAfterEvaluation = YES;
// Whether to enable a prompt upon clicking Back. NO by default; YES by setting, it will prompt "whether to end the chat"
kitInfo.isShowReturnTips = YES;
2
3
4
5
6
7
8
# 4. Configure chat release after users submit agent satisfaction evaluation
/**
* Whether to close the chat after agent evaluation (release the chat after agent satisfaction evaluation).
* NO (OFF) by default
*
*/
@property (nonatomic,assign) BOOL isCloseAfterEvaluation;
2
3
4
5
6
7
8
# 5. When clicking Back on the top left corner or Close on the top right corner, configure whether to display Not Evaluate Now button on the agent satisfaction evaluation pop-up window
/**
* Turn on satisfaction evaluation when clicking Back and display Not Evaluate Now button
* NO (OFF) by default
*/
@property (nonatomic,assign) BOOL canBackWithNotEvaluation;
2
3
4
5
6
7
# ● About Message
# 1. Message push
Note: If you need the SDK push function, please refer to the following message notification and registration push related code. If your project does not need it, please skip it.
When generating the appkey, upload the push certificate (.p12 format), and export the certificate with a password;
Push is only effective when chatting with an agent. The bot answers directly without push; When the local IM is in normal communication, it will go directly to the supported IM channel and will not send apns push;
Relevant configuration and code
Push ZCLibClient.h key attribute description
/**
Push token
It needs to be reset every time when the app is initiated
*/
@property (nonatomic,strong) NSData *token;
/**
Test mode,
Push certificate called as per this setting, NO by default
NO, call production environment
YES, test environment
*/
@property (nonatomic,assign) BOOL isDebugMode;
/**
Auto reminder message
Note: If the auto reminder message is enabled, when the user is not on the Sobot chat page, it will actively display the message as a local notification
This reminder is a local message push, which has nothing to do with apns. It is only a reminder of the local IM message when the user is not on the chat page
*/
@property (nonatomic,assign) BOOL autoNotification;
/**
After exiting the backend, whether to close Keep-Alive connection automatically, NO by default
Note: If it's YES by setting, the channel will be closed upon exiting the backend, but it doesn't affect the app pending duration in the backend
*/
@property (nonatomic,assign) BOOL autoCloseConnect;
/**
Get unread messages
@return Unread messages (will be cleared when entering the Sobot chat page)
*/
-(int) getUnReadMessage;
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
Push registration
Register push in AppDelegate.m file
Import header file
#import <SobotKit/SobotKit.h>
#import <UserNotifications/UserNotifications.h>
#define SYSTEM_VERSION_GRATERTHAN_OR_EQUALTO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
2
3
Adopted protocol
<UIApplicationDelegate,UNUserNotificationCenterDelegate>
2
3
Registration
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
if (SYSTEM_VERSION_GRATERTHAN_OR_EQUALTO(@"10")) {
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
[center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert |UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error) {
if (!error) {
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
}];
}else{
[self registerPush:application];
}
[[ZCLibClient getZCLibClient].libInitInfo setApp_key:@"your appKey"];
// Set whether the push is made in test environment; if YES, development certificate will be used
[[ZCLibClient getZCLibClient] setIsDebugMode:YES];
// Error log collection
[ZCLibClient setZCLibUncaughtExceptionHandler];
return YES;
}
-(void)registerPush:(UIApplication *)application{
// After ios8, this registration shall be added to get authorization
if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)]) {
// IOS8
// Create UIUserNotificationSettings, and set the message display type
UIUserNotificationSettings *notiSettings = [UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeAlert | UIRemoteNotificationTypeSound) categories:nil];
[application registerUserNotificationSettings:notiSettings];
} else{ // ios7
[application registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeSound|UIRemoteNotificationTypeAlert)];
}
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)pToken{
NSLog(@"---Token--%@", pToken);
// Register token
[[ZCLibClient getZCLibClient] setToken:pToken];
}
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
# 2. Set whether to enable message reminder
If a user is not on the chat page but receives any message from the agent, APP can give a reminder on the notification bar or chat entry. The notification bar reminder can display the content of the latest message.
// Whether to enable auto reminder. When the user is not on the chat page, the system will actively send a local push upon receiving a local connection message
[[ZCLibClient getZCLibClient] setAutoNotification:YES];
// Set push environment
[[ZCLibClient getZCLibClient] setIsDebugMode:NO];
2
3
4
5
6
# 3. Offline message
Offline message setting
// Set to disconnect Keep-Alive automatically upon switching to the backend, which will not affect the app pending duration in the backend
// It will reconnect automatically when entering the frontend. During disconnection, message will be pushed via apns
[ZCLibClient getZCLibClient].autoCloseConnect = YES;
// @note Check if the current message channel is set up; if not, please set up one. If closeIMConnection has been called, you can call this method to reconnect.
[[ZCLibClient getZCLibClient] checkIMConnected];
/* Check if the current monitoring has been removed. If it is removed, re-register (re-activate
network monitoring ZCNotification_NetworkChange
UIApplicationDidBecomeActiveNotification
UIApplicationDidEnterBackgroundNotifica
). It's often used together with checkIMConnected
*/
[[ZCLibClient getZCLibClient] checkIMObserverWithRegister];
/**
Removing all IM monitoring may affect the app living duration in the backend. If this method has been called, you have to re-activate checkIMObserverWithCreate
network monitoring ZCNotification_NetworkChange
UIApplicationDidBecomeActiveNotification
UIApplicationDidEnterBackgroundNotification
*/
[[ZCLibClient getZCLibClient] removeIMAllObserver];
/**
@note Close the current message channel to stop receiving messages. If push has been configured, messages will be sent via apns
*/
[[ZCLibClient getZCLibClient] closeIMConnection];
// ReceivedMessageBlock Unread messages, obj Current message unRead Unread messages
[ZCLibClient getZCLibClient].receivedBlock = ^(id obj,int unRead,NSDictionary *object){
// NSLog(@"message:%d \n %@",unRead,obj);
};
// Close the channel, clear up memory, and exit the Sobot system (If it's in agent mode, the customer will go offline; if it's in bot mode, the current chat will be ended directly, and it will be a new chat when entering the page next time)
// Note: After calling this method, you cannot receive any offline message unless you re-enter the Sobot system SDK and re-activate the function
// isClosePush:YES, disable push; NO, offline user, but still can receive push
+(void) closeAndoutZCServer:(BOOL) isClosePush;
// Example
[ZCLibClient closeAndoutZCServer:YES];
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
# 4. Unread message operation
// Directly get unread messages
[[ZCLibClient getZCLibClient] getUnReadMessage];
// Clear unread messages
[[ZCLibClient getZCLibClient] clearUnReadNumber:@"partnerid"];
2
3
4
# 5. Send location message
Send location information. For this method, positioning call can be initiated only when receiving url=sobot:// sendlocation monitored by the initialized link; otherwise, the user may fail to send. For details, refer to canSendLocation attribute description in ZCKitInfo.h
ZCKitInfo *uiInfo=[ZCKitInfo new];
// Set to enable sending
uiInfo.canSendLocation = YES;
// Configure sending button, and note that menu1.url = sobot:// sendlocation monitors in messageLinkClick of the initiation page
NSMutableArray *arr = [[NSMutableArray alloc] init];
for (int i = 0; i<1; i++) {
ZCLibCusMenu *menu1 = [[ZCLibCusMenu alloc] init];
menu1.title = [NSString stringWithFormat:@"location"];
menu1.url = [NSString stringWithFormat:@"sobot:// sendlocation"];;
menu1.imgName = @"zcicon_sendlocation";
[arr addObject:menu1];
ZCLibCusMenu *menu2 = [[ZCLibCusMenu alloc] init];
menu2.title = [NSString stringWithFormat:@"goods"];
menu2.url = [NSString stringWithFormat:@"sobot:// sendProductInfo"];;
menu2.imgName = @"zcicon_sendpictures";
[arr addObject:menu2];
}
uiInfo.cusMoreArray = arr;
// Location sending method. fullPath is the complete local photo path
[ZCSobotApi sendLocation:@{
@"lat":@" 40.001693 ",
@"lng":@" 116.353276 ",
@"localLabel":@"address",
@"localName":@"title",
@"file":fullPath}];
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
# 6. Link interception
Implement via the code before initialization:
/// Click link interception Help Center, submission, chat, submission record
/// @param messagelinkBlock Accessed link. If YES is returned, intercept
[ZCSobotApi setMessageLinkClick:^BOOL(NSString *linkUrl) {
return NO;
}];
2
3
4
5
6
7
Intercept links clicked by users in messages
# 7. Monitor any change of the current chat mode
Implement via the code before initialization:
// Current user chat status
typedef NS_ENUM(NSInteger,ZCServerConnectStatus) {
ZCServerConnectOffline = 0, // Current chat has ended
ZCServerConnectRobot = 1, // Chatbot
ZCServerConnectArtificial = 2, // Agent accessed
ZCServerConnectWaiting = 3 // Agent queue only
};
[[ZCLibClient getZCLibClient] setServerConnectBlock:^(id message, ZCServerConnectStatus status, NSDictionary *object) {
}];
// Return event monitoring
[ZCSobotApi setZCViewControllerBackClick:^(id _Nonnull obj, ZCPageCloseType type) {
NSLog(@"click close%@,%d",obj,type);
}];
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 8. Replace the regular expression for mobile phone or landline telephone identification in messages
Modify your own phone no. identification rule:
/**
* Regular expression for phone no.
* Set by default as @"0+\\d{2}-\\d{8}|0+\\d{2}-\\d{7}|0+\\d{3}-\\d{8}|0+\\d{3}-\\d{7}|1+[34578]+\\d{9}|\\+\\d{2}1+[34578]+\\d{9}|400\\d{7}|400-\\d{3}-\\d{4}|\\d{11}|\\d{10}|\\d{8}|\\d{7}"
* E.g.: 82563452, 01082563234, 010-82543213, 031182563234, 0311-82563234
、+8613691080322、4008881234、400-888-1234
*/
@property (nonatomic,strong) NSString * telRegular;
2
3
4
5
6
7
8
9
# 9. Replace the regular expression for hyperlink identification in chat messages
Modify hyperlink identification rule in messages
/**
* Regular expression for link URL
* Set by default as:
@"((http[s]{0,1}|ftp):// [a-zA-Z0-9\\.\\-]+\\.([a-zA-Z0-9]{1,4})(:\\d+)?(/[a-zA-Z0-9\\.\\-~!@#$%^&*+?:_/=<>]*)?)|(([a-zA-Z0-9]{2,4}).[a-zA-Z0-9\\.\\-]+\\.([a-zA-Z]{2,4})(:\\d+)?(/[a-zA-Z0-9\\.\\-~!@#$%^&*+?:_/=<>]*)?)"
*/
@property (nonatomic,strong) NSString * urlRegular;
2
3
4
5
6
7
8
9
10
# 10. Hide time prompt in the message list
/**
Whether to hide chat time, NO (not hide) by default. If you are not in China and your time is different from the actual time at the customer side, you can hide the time during chat
*/
@property (nonatomic,assign) BOOL hideChatTime;
2
3
4
5
6
7
8
# ● Customize UI Settings
- We support customizing the color and font color in navigation bar area.
- We support customizing the background color, chat bubble color, chat font color, prompt bubble color, prompt font color, and time text color in the chat page area.
- We support customizing the bottom background color and input box line background color in the bottom area.
- In other parts, we support customizing the background color and font color of the album navigation bar, the font color and button color in the evaluation pop-up box, the font color in the recording control and the product details display (title, details, tag, and send).
- Image replacement. If you want to replace the image displayed in the SDK, you can directly replace the resource in SobotKit.bundle; You can also put a same resource name in your own project, and then the image resource in the project will be accessed first.
# 1. Configure attributes
For the specific code implementation, refer to the ZCKitInfo class description in ZCKitInfo.h file in the code
ZCKitInfo *uiInfo=[ZCKitInfo new];
// E.g.: Set the chat page background to red
uiInfo.backgroundColor = [UIColor redColor];
// Set the top navigation to green
uiInfo.topViewBgColor = [UIColor greenColor];
// Pass it when initiating the page
[ZCSobotApi openZCChat:uiInfo with:self pageBlock:^(id _Nonnull object, ZCPageBlockType type) {
}];
2
3
4
5
6
7
8
9
10
11
12
13
【Note: For the customized UI not involved in the code, you can directly replace the image in SobotKit.bundle to achieve the desired effect or directly put an image with the same name into your project. At present, the SDK only supports Html tags like hyperlink A, italic I, bold: strong, b, newline br, which can be combined at will. Html tags other than the above cannot be processed well and will be directly filtered out】
# 2. Customize top title
ZCLibInitInfo *initInfo = [ZCLibClient getZCLibClient].libInitInfo;
// 0. By default, auto judge to display bot avatar and agent avatar
// 1. Always display enterprise name and logo
// 2. Display custom title and image, which is required to set custom_title, custom_title_url
// 3. Display bot or agent name only, instead of avatar
// 4. Auto judge to display bot or agent avatar and name
initInfo.title_type = @"0";
// The configuration below works only when title_type=@"2"
initInfo.custom_title = @"custom title,title_type=2 used";
initInfo.custom_title_url = @"custom avatar,title_type=2 used";
2
3
4
5
6
7
8
9
10
11
12
# ● Other Configuration
# 1. Customize auto response
Auto response in SDK can be set dynamically at the PC console.
If the PC console setting cannot meet your requirement, you can use the API below to conduct local configuration in the code
Note: Local setting works first, and PC setting will no longer work.
- (void)customTipWord:(ZCLibInitInfo*)libInitInfo{
// Prompt of user timeout & offline
libInitInfo.user_out_word = @"Prompt message indicating that the user has timed out and is offline";
// Prompt of user timeout
libInitInfo.user_tip_word = @"User timeout message";
// Agent prompt
libInitInfo.admin_tip_word = @"Customer service timeout message";
// Bot Greeting
libInitInfo.robot_hello_word = @"robot hello word tips";
// Reply of no agent online
libInitInfo.admin_offline_title = @"admin offline tips";
// Agent Greeting
libInitInfo.admin_hello_word = @"admin hello word tips";
}
2
3
4
5
6
7
8
9
10
11
12
13
14
# 2. Customize chat history display time range
If you want to set chat history within x day(s) viewable by users, you can call the method below:
/**
History time range, in minute (E.g.: 100- means the chat history in the latest 100min)
*/
@property(nonatomic,assign) int scope_time;
2
3
4
5
# 3. "+" panel menu extension
- Fixed button configuration;
ZCKitInfo *uiInfo=[ZCKitInfo new];
uiInfo.canSendLocation = NO;
uiInfo.hideMenuSatisfaction = YES;
// uiInfo.hideMenuLeave = YES;
// uiInfo.hideMenuPicture = YES;
// uiInfo.hideMenuCamera = YES;
// uiInfo.hideMenuFile = YES;
2
3
4
5
6
7
8
- Add custom button
On the menu panel after clicking "+" button on the agent chat interface, you can add menu as per your needs. The code is as follows:
ZCKitInfo *uiInfo=[ZCKitInfo new];
NSMutableArray *arr = [[NSMutableArray alloc] init];
for (int i = 0; i<1; i++) {
ZCLibCusMenu *menu1 = [[ZCLibCusMenu alloc] init];
menu1.title = [NSString stringWithFormat:@"order"];
menu1.url = [NSString stringWithFormat:@"sobot:// sendOrderMsg"];
menu1.imgName = @"zcicon_sendpictures";
[arr addObject:menu1];
ZCLibCusMenu *menu2 = [[ZCLibCusMenu alloc] init];
menu2.title = [NSString stringWithFormat:@"goods"];
menu2.url = [NSString stringWithFormat:@"sobot:// sendProductInfo"];
menu2.imgName = @"zcicon_sendpictures";
[arr addObject:menu2];
}
uiInfo.cusMoreArray = arr;
uiInfo.cusRobotMoreArray = arr;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Where:
/**
* Customize the content below the More ("+" icon) button below the input box (it will not replace the original content, but will be added on the original basis)
* Modify the button for agent mode
* Fill in: ZCLibCusMenu.h
* title :button Name
* url: Click the link (after clicking, initialization linkBock will be called)
* imgName: Local image name, such as xxx@2x.png,icon=xxx
*/
@property (nonatomic,strong) NSMutableArray * cusMoreArray;
/**
* Customize the content below the More ("+" icon) button below the input box (it will not replace the original content, but will be added on the original basis)
* Modify the button for bot mode
* Fill in: ZCLibCusMenu.h
* title :按钮 Name
* url: Click the link (after clicking, initialization linkBock will be called)
* imgName: Local image name, such as xxx@2x.png,icon=xxx
*/
@property (nonatomic,strong) NSMutableArray * cusRobotMoreArray;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 4. Call the dial interface API
/**
* set Phone no
* When Dial button is displayed on the top right corner of the navigation bar (it's valid when setting together with isShowTelIcon )
*
**/
@property (nonatomic,copy) NSString * customTel;
/**
*
* Whether to display Dial button on the top right corner of the navigation bar. Not display by default. Note: It's mutually exclusive with isShowEvaluation, so you only can set one
*
**/
@property (nonatomic,assign) BOOL isShowTelIcon;
2
3
4
5
6
7
8
9
10
11
12
# 5. Sobot log display ON/OFF
/**
* Display log information
*
* @param isShowDebug Not display by default
*/
+(void) setShowDebug:(BOOL) isShowDebug;
2
3
4
5
6
# 6. iOS multi-language support
The language will automatically switch and adapt according to the current mobile language. If the current mobile language is not identified, Chinese is used by default.
All language files shall be saved in SobotKit.bundle. If you need to add a language pack, just save the supported language file into the corresponding language directory. E.g.: English path: SobotKit.bundle/en_lproj/SobotLocalizable.strings, Chinese path: SobotKit.bundle/zh-Hans_lproj/SobotLocalizable.strings;
[Note: The language folder name is the current language name followed by _ lproj, such as zh-Hans_lproj, en_lproj]
《SDK supports language》 (opens new window)
// Get the language name
NSString * languages = [ZCSobotApi getCurLanguagePreHeader];
ZCLibInitInfo *initInfo = [ZCLibClient getZCLibClient].libInitInfo;
// Set the default language. If the current system language cannot be identified, and the default language is not set, it will be en_lproj by default
initInfo.default_language = @"zh-Hans_lproj";
// Designate a language. The designated language does not change by the system language. If the designated language is not found, it will run the default language logic
initInfo.absolute_language = @"ar_lproj";
// Download a language (available for SDK above 2.8.6). If you require supporting other languages other than bundle pack, you can provide language translation in our server for dynamic synchronization
/// Synchronize language file at the server
/// @param lan Language to be synchronized. If the language exists in the local bundle, it won't be downloaded, en_lproj,zh-Hans_lproj
/// @param isReWrite Whether to download the language again if it has been downloaded
+(void)synchronizeLanguage:(NSString *) language write:(BOOL) isReWrite;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Special processing:
If the agent evaluation or bot evaluation tag is configured for the multi-language version, the multi-lingual display is not supported. The display can be hidden through the following attributes (it does not affect the use of evaluation function, and only the tag is missing in the evaluation content).
// Hide bot evaluation tag
_kitInfo.hideRototEvaluationLabels = YES;
// Hide agent evaluation tag
_kitInfo.hideManualEvaluationLabels = YES;
2
3
4
5
6
7
8
9
10
11
# 7. Set dark mode
Starting from version 2.8.5, SDK supports dark mode. It can automatically adapt according to the mobile phone system settings by default and can also be designated by configuration. The configuration is as follows:
ZCKitInfo *uiInfo=[ZCKitInfo new];
// The default is 0: follow the system settings; 1: Designate the dark mode; 2: Designate the highlight mode
uiInfo.themeStyle = 1;
// The default is YES; that is, the custom color attribute is invalid in the dark mode
// If you want to keep the custom color valid in the dark mode, you have to set it to NO
uiInfo.useDefaultDarkTheme = YES;
2
3
4
5
6
7
8
9
# 8. Time zone adaptation
It is supported since SDK 2.8.9. The default system time is the GMT+8 standard Beijing time. If you need to dynamically adapt to the mobile phone time zone, configure the following code:
[ZCSobotApi setAutoMatchTimeZone:YES];
2
3
# 9. For monitoring Back click event on some function pages of Sobot system (record only, not intercept), you can add logic (such as buried point)
[ZCSobotApi setFunctionClickListener:^(id _Nonnull obj, ZCPageCloseType type) {
// 1: Back on submission page, 2: Back on chat page, 3: Back on Help Center page, 4: Back on E-commerce Message Center page, 5: Phone button
NSLog(@"click close%@,%zd",obj,type);
}];
2
3
4
5
6
# Configuration Class Attribute Description
# ● ZCKitInfo Class Description (UI-related configuration)
It can be reset every time when the Sobot page is initiated
# 1. About UI logic
Param | Type | Required | Description |
---|---|---|---|
isOpenEvaluation | BOOL | No | Whether to turn on satisfaction evaluation upon clicking Back |
isCloseAfterEvaluation | BOOL | No | After turning on satisfaction evaluation upon clicking Back, whether to close the chat after agent evaluation |
isShowTansfer | BOOL | No | In bot first mode, whether to directly display trans-to-agent button (If the value is NO, it will display trans-to-agent button in cooperation with unWordsCount when the bot cannot answer). The default is YES: Display trans-to-agent button |
unWordsCount | NSString | No | In bot first mode, set whether to directly display trans-to-agent button by recording the bot unknown replies |
isShowTelIcon | BOOL | No | Whether to display Dial button on the top right corner of the navigation bar. Not display by default. Note: It's mutually exclusive with isShowEvaluation, so you only can set one |
isShowEvaluation | BOOL | No | Whether to display Evaluation button on the top right corner of the navigation bar, NO by default |
customTel | NSString | No | When Dial button is displayed on the top right corner of the navigation bar (it's valid when setting together with isShowTelIcon) |
isOpenRecord | BOOL | No | Whether to turn on the voice function (In agent reception mode, it's YES (ON) by default.) |
isShowNickName | BOOL | No | Whether to display nickname input box on the submission page, NO (Not display) by default. |
isAddNickName | BOOL | No | Not required to enter. Whether to require entering nickname upon submission, NO by default |
isSetPhotoLibraryBgImage | BOOL | No | Whether to set album background image (If not set, it will follow the navigation color setting) |
isOpenRobotVoice | BOOL | No | Whether to enable bot voice (It's required to enable; otherwise bot cannot recognize voice) |
navcBarHidden | BOOL | No | On SDK page, use the customized navigation bar, instead of the system navigation bar (hidden) |
canSendLocation | BOOL | No | In agent mode, whether the user can send location 【 Note: Due to the different selection of location plug-ins for each app, Sobot does not implement the function of location selection, so you need to pass the location to the SDK and enable the display by yourself. The steps are as follows: 1. Implement the messageLinkClick event (in the ZCSobot startZCChatVC function) 2. When receiving link=sobot:// sendlocation, call Sobot API to send location information 3 、 When receiving link = sobot openlocation?latitude=xx&longitude=xxx&address=xxx, you can handle relevant business according to your own situation |
isSendInfoCard | BOOL | No | Whether to auto send product card information (After trans-to-agent is done, auto send product card information). Not auto send by default. |
isEveryTimeSendCard | BOOL | No | Whether to auto send product information every time (After trans-to-agent is done, auto send product card information). You have to first enable isSendInfoCard = YES. |
productInfo | ZCProductInfo | No | Product information, used with isSendInfoCard |
isShowCloseSatisfaction | BOOL | No | Whether to display the evaluation interface upon clicking Close button. Not display by default |
isShowReturnTips | BOOL | No | Whether to enable prompt upon clicking Back. The default prompt text is: Do you want to end the chat? If you want to modify it, please modify the international configuration file |
ishidesBottomBarWhenPushed | BOOL | No | Whether to hide BottomBar after push, YES by default. |
isShowPortrait | BOOL | No | Whether to support portrait mode only, NO by default. |
isCloseInquiryForm | BOOL | No | Whether to close the pre-query form (NO by default, follow the system default configuration) |
isShowClose | BOOL | No | Whether to display Close button on the top right corner of the navigation bar. Not display by default. After clicking Close button, the system cannot monitor the backend messages. |
isUseImagesxcassets | BOOL | No | Whether to use images in .xcassets |
isOpenActiveUser | BOOL | No | Whether to enable intelligent trans-to-agent (E.g., after entering "trans-to-agent", it directly transfers to agent). If you want to hide the trans-to-agent button, please refer to isShowTansfer and unWordsCount attributes. |
activeKeywords | BOOL | No | Intelligent trans-to-agent keywords, keywords are key{@"trans-to-agent",@"1",@"R"😡"1"} |
autoSendOrderMessage | BOOL | No | After trans-to-agent, whether to actively send a message |
isEveryTimeAutoSend | BOOL | No | Whether to send order information every time. You have to first set the param autoSendOrderMessage = YES. |
orderGoodsInfo | ZCOrderGoodsModel | No | Order information to be sent, used with autoSendOrderMessage |
leaveCompleteCanReply | BOOL | No | After submission is done, whether to display Reply button, YES by default, you can reply. |
hideMenuSatisfaction | BOOL | No | Function in the "+" at the bottom of chat page: Hide evaluation, NO (not hide) by default |
hideMenuLeave | BOOL | No | Submission (agent and bot) in the "+" at the bottom of chat page, NO (not hide) by default |
hideMenuManualLeave | BOOL | No | Submission (agent only) in the "+" at the bottom of chat page, NO (not hide) by default |
hideMenuPicture | BOOL | No | Function in the "+" at the bottom of chat page: Hide photos, NO (not hide) by default |
hideMenuCamera | BOOL | No | Function in the "+" at the bottom of chat page: Hide camera, NO (not hide) by default |
hideMenuFile | BOOL | No | Function in the "+" at the bottom of chat page: Hide files, NO (not hide) by default |
themeStyle | BOOL | No | Whether to set to dark mode, 2: standard mode; 1: dark mode; 0: follow the system settings. It's 0 by default |
useDefaultDarkTheme | BOOL | No | If the custom color is set, whether to use the default dark mode. If it is set to NO, the custom color attribute will be invalid when it is dark mode. It's YES by default |
leaveContentPlaceholder | NSString | No | Customize submission content preset text |
leaveMsgGuideContent | NSString | No | Customize submission guidance text |
leaveCusFieldArray | NSMutableArray | No | Directly enter the submission custom field |
leaveMsgGroupId | NSString | No | Get submission skill group ID: Settings —> Ticket Skill Group Setting |
hideChatTime | BOOL | No | Whether to hide chat time, NO by default |
hideRototEvaluationLabels | BOOL | No | Whether to hide the bot evaluation tag, NO (not hide) by default. |
hideManualEvaluationLabels | BOOL | No | Whether to hide the agent evaluation tag, NO (not hide) by default. |
helpCenterTel | NSString | No | In Help Center, phone no. can jump to the dialing interface. Not display by default |
helpCenterTelTitle | NSString | No | Phone no. display content in Help Center; Not display by default |
showPhotoPreview | BOOL | No | When selecting a picture, do not send it directly, but preview and send it 【Note: the preview box is only a magnifier effect, not a cut-out picture, and the picture you send is still original】. NO (off) by default |
leaveTemplateId | NSString | No | Submission template ID 【Note: it's used with ZCChatControllerDelegate】 |
hideNavBtnMore | BOOL | No | Whether to hide the "..." More button on the top right corner of navigation, NO (not hide) by default |
hideQRCode | BOOL | No | Whether to disable the QR code identification function. YES (OFF) by setting, NO (ON) by default |
isCloseSystemRTL | BOOL | No | Whether to disable the mirror-image function. YES (OFF) by setting, NO (ON) by default |
showLeftMsgFace | BOOL | No | Whether to display the chat customer service avatar function. YES (on) by setting, NO (ON) by default |
showLeftMsgNickName | BOOL | No | Whether to display the nickname function of chat customer service. YES (on) by setting, NO (ON) by default |
# 2. About font
Param | Type | Required | Description |
---|---|---|---|
titleFont | UIFont | No | Top title font |
subTitleFont | UIFont | No | Subtitle font |
listTitleFont | UIFont | No | List title font |
listDetailFont | UIFont | No | Unread message button & evaluation tag font |
customlistDetailFont | UIFont | No | Whether any of the following conditions exists tag font on the evaluation page |
listTimeFont | UIFont | No | Message reminder (time, trans-to-agent, agent reception etc.) font |
chatFont | UIFont | No | Chat bubble text font |
voiceButtonFont | UIFont | No | Record button text font |
goodsTitleFont | UIFont | No | Title font in product details cell |
goodsDetFont | UIFont | No | Digest font in product details cell |
notificationTopViewLabelFont | UIFont | No | Announcement font size |
scTopTextFont | UIFont | No | Help Center title font |
scTopBackTextFont | UIFont | No | Top Back button font |
# 3. About background color
Param | Type | Required | Description |
---|---|---|---|
goodSendBtnColor | UIColor | No | btn background color in product details cell |
backgroundColor | UIColor | No | Chat page background color |
leftChatColor | UIColor | No | Left chat bubble color |
rightChatColor | UIColor | No | Right chat bubble color |
leftChatSelectedColor | UIColor | No | Left bubble selected copy color |
rightChatSelectedColor | UIColor | No | Right bubble selected copy color |
backgroundBottomColor | UIColor | No | Bottom background color |
bottomLineColor | UIColor | No | Bottom frame edge/line color (input box, record button, separator) |
commentCommitButtonColor | UIColor | No | Evaluation submission button background color |
commentItemButtonBgColor | UIColor | No | Evaluation option button default color (follow the theme color by default) |
commentItemButtonSelBgColor | UIColor | No | Evaluation option button selected color (follow the theme color by default) |
BgTipAirBubblesColor | UIColor | No | Prompt bubble background color |
videoCellBgSelColor | UIColor | No | Voice cell selected background color |
LineRichColor | UIColor | No | Line color in rich text |
goodSendBtnColor | UIColor | No | Product Send button background color |
leaveSubmitBtnImgColor | UIColor | No | Submit button background color on the submission page |
topBackNolColor | UIColor | No | Back button default background color |
topBackSelColor | UIColor | No | Back button highlight background color |
topViewBgColor | UIColor | No | Custom navigation bar background color |
scTopBgColor | UIColor | No | Help Center navigation bar background color |
documentLookImgProgressColor | UIColor | No | File View, ImgProgress image background color |
documentBtnDownColor | UIColor | No | File View, button background color |
notificationTopViewBgColor | UIColor | No | Announcement bar background color |
satisfactionSelectedBgColor | UIColor | No | Resolved and "Unresolved" background color on the evaluation page |
# 4. About text color
Param | Type | Required | Description |
---|---|---|---|
topViewTextColor | UIColor | No | Top text color |
leftChatTextColor | UIColor | No | Left bubble text color |
rightChatTextColor | UIColor | No | Right bubble text color |
emojiSendBgColor | UIColor | No | Emoji keypad Send button background color, new function for SDK 2.8.5 |
chatTextViewColor | UIColor | No | Input box text color |
timeTextColor | UIColor | No | Time text color |
tipLayerTextColor | UIColor | No | Prompt text color |
chatLeftLinkColor | UIColor | No | Left bubble link color |
chatRightLinkColor | UIColor | No | Right bubble link color |
goodsTitleTextColor | UIColor | No | Product cell title text color |
goodsTipTextColor | UIColor | No | Product cell tag text color |
goodsDetTextColor | UIColor | No | Product cell digest text color |
goodsSendTextColor | UIColor | No | Product details cell Send text color |
satisfactionTextColor | UIColor | No | Chat end text color after evaluation is submitted |
noSatisfactionTextColor | UIColor | No | Not Evaluate Now text color |
satisfactionTextSelectedColor | UIColor | No | Resolved and "Unresolved" text color on the evaluation page |
scoreExplainTextColor | UIColor | No | Satisfaction star level description text color |
commentButtonTextColor | UIColor | No | Evaluation (condition selection button) text color (follow the theme color by default) |
submitEvaluationColor | UIColor | No | Submit Evaluation button text color |
notificationTopViewLabelColor | UIColor | No | Announcement bar text color |
chatLeftMultColor | UIColor | No | Multi-round chat template 4 hyperlink color |
openMoreBtnTextColor | UIColor | No | In multi-round chat, Unfold and Fold text color |
topBtnNolColor | UIColor | No | In chat box, like/dislike & trans-to-agent text default color |
topBtnSelColor | UIColor | No | In chat box, like/dislike & trans-to-agent text selected color |
topBtnGreyColor | UIColor | No | Like/dislike text Gray color |
leaveSubmitBtnTextColor | UIColor | No | Submit button text color on the submission page |
scTopTextColor | UIColor | No | In Help Center, navigation title text color |
scTopBackTextColor | UIColor | No | In Help Center, top Back text color |
# 5. About image
Param | Type | Required | Description |
---|---|---|---|
moreBtnNolImg | NSString | No | Customize navigation bar More button default status image |
moreBtnSelImg | NSString | No | Customize navigation bar More button selected status image |
turnBtnSelImg | NSString | No | Trans-to-agent button selected status image |
turnBtnNolImg | NSString | No | Trans-to-agent button default status image |
topBackSelImg | NSString | No | Back button selected status image |
topBackNolImg | NSString | No | Back button default status image |
# 6. Miscellaneous
Param | Type | Required | Description |
---|---|---|---|
topBackTitle | NSString | No | Back button text on the top left corner of chat page (The default text is "Back") |
cusMoreArray | NSMutableArray | No | Customize the content below the More ("+" icon) button below the input box (it will not replace the original content, but will be added on the original basis) Fill in: ZCLibCusMenu.h title :button Name url:click Link (after Initialization linkBock) imgName:local Image Name. ,example xxx@2x.png,icon=xxx |
cusMenuArray | NSMutableArray | No | Customize shortcut entry Fill in: ZCLibCusMenu.h url: Shortcut entry link (after clicking, initialization linkBock will be called) title: Button title lableId: Customize shortcut entry ID |
cusRobotMoreArray | NSMutableArray | No | Customize the content below the More ("+" icon) button below the input box (it will not replace the original content, but will be added on the original basis) Fill in: ZCLibCusMenu.h |
# ● ZCLibInitInfo Class Description
This object will be created automatically after initialization, and can be used directly later
# 1. Basic configuration
Param | Type | Required | Description |
---|---|---|---|
api_host | NSString | No | API host, Default SaaS platform domain name :https://api.sobot.com (opens new window) |
app_key | NSString | Yes | Setting is required; if not, initialization will fail. Initialization will auto assign a value |
choose_adminid | NSString | No | Designate agent ID |
tran_flag | int | No | Designate agent transfer type, 0: Transfer to any agent; 1: Transfer to the designated agent alone |
partnerid | NSString | No | The user's unique ID, which is docked with the user's reliable identity, cannot be fixed (If it's a fixed value, it will be the same identity, resulting in severe consequences). Null is not recommended. If it is null, it will be distinguished by device. It supports 300 chars max. If it exceeds the limit, the excess part will be automatically intercepted |
robotid | NSString | No | Docking bot ID |
robot_alias | NSString | No | Docking bot ID alias. If you set this value, you have to set robotid to null every time |
platform_userid | NSString | No | Platform channel param, auto assign after initialization |
platform_key | NSString | No | Private key |
sign | NSString | No | Signature MD5 (app_key+partnerid+secret+create_time) |
create_time | NSString | No | Timestamp for signing |
- Params for E-commerce only
Set E-commerce trans-to-agent overflow. The following attribute conflicts with transferaction. If transferaction is set, flow_type, flow_companyid, flow_groupid configuration will be overwritten.
Param | Type | Required | Description |
---|---|---|---|
customer_code | NSString | No | Merchant docking ID (E-commerce only. In case of no app_key, it must be provided) |
flow_type | int | No | Intercompany transfer to agent (E-commerce only) 0: OFF, 1: All overflow, 2: Overflow at occupied status, 3: Overflow at offline status; 0 by default. |
flow_companyid | NSString | No | Transfer receiving company ID |
flow_groupid | NSString | No | Transfer receiving company skill group |
# 2. Agent workbench display data
Param | Type | Required | Description |
---|---|---|---|
user_nick | NSString | No | Nickname |
user_name | NSString | No | Real Name |
user_tels | NSString | No | User's phone no. |
user_emails | NSString | No | User's e-mail |
NSString | No | ||
remark | NSString | No | Note |
face | NSString | No | User's custom avatar |
visit_title | NSString | No | Accessed source page title |
visit_url | NSString | No | Accessed source URL |
params | NSDictionary | No | User profile |
customer_fields | NSDictionary | No | Fixed KEY custom field. All keys take effect after console settings (Settings -> Custom Fields -> User Info Fields) |
group_name | NSString | No | Skill Group Name |
groupid | NSString | No | Skill group no. |
isVip | NSString | No | Designate whether the customer is VIP, 0: General 1: VIP, same as PC Settings - Live Chat Assignment - Queue Priority Setting - VIP Customer Queue First. Enable passing 1 (Not set by default). After enabling, when the designated customer initiates an inquiry, in case of queuing, the system will receive the customer first. |
vipLevel | NSString | No | Designate customer VIP level, pass a level |
# 3. About reply
Param | Type | Required | Description |
---|---|---|---|
admin_hello_word | NSString | No | Custom agent greeting, blank by default (If any field is passed, the field will be used first) |
robot_hello_word | NSString | No | Custom bot greeting, blank by default (If any field is passed, the field will be used first) |
user_tip_word | NSString | No | Custom user timeout prompt, blank by default (If any field is passed, the field will be used first) |
admin_offline_title | NSString | No | Custom reply of agent offline, blank by default (If any field is passed, the field will be used first) |
admin_tip_word | NSString | No | Custom agent timeout prompt, blank by default (If any field is passed, the field will be used first) |
user_out_word | NSString | No | Custom prompt of user timeout & offline, blank by default (If any field is passed, the field will be used first) |
# 4. About chat page
Param | Type | Required | Description |
---|---|---|---|
service_mode | int | No | Customize access mode: 1. Bot only 2. Agent only 3. Intelligent Agent - Bot first 4. Intelligent Agent - Agent first |
title_type | NSString | No | Customize chat page top title: 0. By default, 1. Enterprise name, 2. Custom field, 3. Display text only, 4. Display avatar and text. |
custom_title | NSString | No | Chat page top title Custom field |
custom_title_url | NSString | No | Custom image path |
scope_time | int | No | History time range, in minute (E.g.: 100- means the chat history in the latest 100min) |
notifition_icon_url | NSString | No | Announcement icon URL |
faqId | int | No | Designate guidance text. Set specific guidance texts for different users |
# 5. Miscellaneous
Param | Type | Required | Description |
---|---|---|---|
is_enable_hot_guide | BOOL | No | Whether to permit requesting hotspot guidance question API |
margs | NSDictionary | No | Extension field of hotspot guidance questions |
support | BOOL | No | Whether bot Q&A supports word association |
transferaction | NSArray | No | Trans-to-agent designated skill group overflow. For details, see the description below the table |
summary_params | NSDictionary | No | Trans-to-agent custom field eg:@{@" customField15619769556831 "😡"showxxyyyzzz1032"} |
multi_params | NSDictionary | No | Multi-round chat Custom field |
good_msg_type | int | No | Customize product order information sending type: 0: Not send 1: Send to bot 2: Send to agent 3: Send to both bot and agent |
content | NSString | No | Auto send product order info |
queue_first | int | No | Designated customer first |
default_language | NSString | No | Default language. If you do not set a default language, when the system language is not identified, the default language will be English, en_lproj |
absolute_language | NSString | No | Designate a language, which will not auto switch by following the system language. |
【transferaction description: actionType:actionType :to_group:trans Designate skill group optionId: Whether to overflow when designating a skill group: 3: Overflow, 4: Not overflow . deciId: Designated skill group. spillId: Overflow conditions when designating an agent group: 4: No agent online in the skill group, 5: All agents occupied in the skill group, 6: Skill group is off duty, 7: Intelligent judgement eg:[{"actionType":"to_group","optionId":" 3 ","deciId":" 162bb6bb038d4a9ea018241a30694064 ","spillId":" 7 "}, {"actionType":"to_group","optionId":" 4 ","deciId":" a457f4dfe92842f8a11d1616c1c58dc1 "}]. 】
# Source Code and Demo
Sobot iOS_SDK UI source code (opens new window);
Sobot SDK function experience Demo APP download (opens new window);
# FAQ
FAQ:
Please click link (opens new window) to enter the intelligent bot page and enter your question
# Description of Sobot SDK's Collection and Use of Personal Information
Description of Sobot SDK's Collection and Use of Personal Information (opens new window)