Developer Documentation Developer Documentation
Help Center (opens new window)
Help Center (opens new window)
  • Channel Access

    • Web Link Access Description
    • Web-JS Access Description
    • Android SDK
    • iOS SDK
    • WeChat Mini Program
    • Flutter、DCloud、APICloud
    • CRM Docking Scheme
  • Live Chat API
  • Chatbot API
  • Agent Component SDK

  • Message Push
  • Online Message Forwarding API
  • Knowledge Base V6 API
  • Chatbot Statistics API
  • Enterprise actively sends offline message API
  • Rule Engine API
  • AI Agent API
  • Live Chat Statistics API
  • Text Product API
  • Channel Access
Sobot
2022-11-03
Menus

iOS SDK V6

# iOS SDK V6

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 * 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:

  • Livechat inquiry: Inquire bot, inquire agent (send/receive images and voice messages), and send emoji;
  • Designate the skill groups for reception;
  • Guide users to make submissions when they are queuing or agents are not online.
  • In the bot first mode, the trans-to-agent button is hidden, and will be displayed when there are N bot unknown questions;
  • Agent satisfaction evaluation: User proactive satisfaction evaluation + evaluation request 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;

Image

Related limits and notes

  1. iOS SDK new version supports version above iOS10, iPhone, iPad and supports both portrait mode and landscape mode.

  2. The currently released xcode version is XCode 13.4.1. It is recommended to use the new version for development.

  3. iOS currently only supports hyperlink tags and does not recognize other html tags and attributes.

  4. iOS requires MIC, camera, album and push permissions; otherwise, some functions are not available.

# 1 File Introduction

# 1.1 Schematic Diagram of Integration Process

Image

# 1.2 File Description

SDK includes (SobotKit.framework, SobotCommon.framework, SobotChatClient.framework and SobotKit.bundle), SobotDemo, and Doc related documentation.

File Name Description Note
SobotKit.framework Sobot SDK UI code library
SobotCommon.framework Sobot SDK basic code library
SobotChatClient.framework Sobot SDK API code library
SobotKit.bundle SDK resource library, containing image files, multilingual files and colors
ZCSobotApi.h The file provides an access function
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

# 2 Integration Method

# 2 Integration Method

# 2.1 Manual Integration

Download link: iOS_SDK (opens new window)

decompression[iOS_SDK],add File SobotKit.framework 、SobotChatClient.framework、 SobotCommon.framework and SobotKit.bundle In 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
  • libz.1.2.5.tbd( dylib)
  • webkit.framwork

# 2.2 CocoPods Integration

Add in podfile:

// Basic:
pod 'SobotChatClient'
// E-commerce:
pod 'SobotChatClientMall'
1
2
3
4

If you cannot find the latest version, run the following command to update the CocoPods

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

1
2
3
4

Delete pod cache:

Delete the pod file folder in the code,
pod cache clean SobotChatClient
and then pod install
1
2
3

# 3.1 Domain Name Settings

Domain name description:

      * If you use 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.]


// Set domain name during initialization; if it's not set, SaaS domain name is used by default
[ZCSobotApi initSobotSDK:@"your appkey" host:@"your host" result:^(id  _Nonnull object) {
    
}];

1
2
3
4
5
6

# 3.2 Get appkey

Log in to Sobot Management Platform (opens new window) to get, as shown in the figure

Image

# 3.3 Initialization

# 3.3.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:


// 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;

1
2
3
4

Param:

Param Name Type Description
app_key NSString app_key must be passed in. Support viewing in Backend -> Settings -> APP
host NSString It's Alibaba Cloud domain name by default. If you want to use other domain names, you need to designate it.
resultBlock NSString Initialization status callback

Sample code:

#import <SobotKit/SobotKit.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {   
      // Override point for customization after application launch.
    NSLog(@"%@",[ZCSobotApi getVersion]);
    // Error log collection (optional)
    // [ZCSobotApi setZCLibUncaughtExceptionHandler];
    // Optional param setting
    if([ZCLibClient getZCLibClient].libInitInfo == nil){
        [ZCLibClient getZCLibClient].libInitInfo = [ZCLibInitInfo new];
    }
    
    // Initialization, must be executed and called before entering SDK
    [ZCSobotApi initSobotSDK:@"your app_key" result:^(id  _Nonnull object) {
        NSLog(@"%@",object);
    }];
    return YES;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

# 3.3.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)
    // [ZCSobotApi setZCLibUncaughtExceptionHandler];
    // Optional param setting
    if([ZCLibClient getZCLibClient].libInitInfo == nil){
        [ZCLibClient getZCLibClient].libInitInfo = [ZCLibInitInfo new];
    }    
    [ZCLibClient getZCLibClient].libInitInfo.platform_key = @"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 = @"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;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

# 3.3.3 Permission Setting

Permissions to be added

<key>NSCameraUsageDescription</key>
  &lt;String&gt;Your camera will be accessed to send photos</string>
  // Not required. You can add as per your needs
<key>NSLocalizedDescription</key>
  &lt;String&gt;Use push service</string>
<key>NSMicrophoneUsageDescription</key>
  &lt;String&gt;Your MIC will be accessed to send voice messages</string>
<key>NSPhotoLibraryUsageDescription</key>
  &lt;String&gt;Your photos will be accessed to send photos</string>
1
2
3
4
5
6
7
8
9

# 3.4 Initiate Sobot Page

# 3.4.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,ZCPageStateType type))pageClick;
    
 
/// Click link interception  Help Center, submission, chat, submission record
/// @param messagelinkBlock  Accessed link. If YES is returned, intercept
+(void)setMessageLinkClick:(BOOL (^)(ZCLinkClickType type,NSString *linkUrl,id _Nullable object))messagelinkBlock;
    
    
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

Param

Param Name Type Description
info ZCKitInfo Custom setting of initialization params
byController UIViewController VC for executing jump
pageClick void (^)(id object,ZCPageBlockType type) Callback upon clicking Back

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];
[ZCSobotApi openZCChat:uiInfo with:vc pageBlock:^(id  _Nonnull object, ZCPageStateType type) {

}];


    [ZCSobotApi setMessageLinkClick:^BOOL(ZCLinkClickType type, NSString * _Nonnull linkUrl, id  _Nullable object) {
        NSLog(@"%@",linkUrl);
        if ([linkUrl containsString:@"sobot:// sendOrderMsg"]) {
            [ZCSobotApi sendOrderGoodsInfo:[ZCUICore getUICore].kitInfo.orderGoodsInfo resultBlock:^(NSString * _Nonnull msg, int code) {
                
            }];
            return YES;
        }
        if ([linkUrl containsString:@"sobot:// sendLocation"]) {
            // Send location information
            [ZCSobotApi sendLocation:@{
                @"lat":@" 40.001693 ",
                @"lng":@" 116.353276 ",
                @"localLabel":@"local",
                @"localName":@"name",
                @"file":@""} resultBlock:^(NSString * _Nonnull msg, int code) {
                
            }];
            return YES;
        }
        if([linkUrl containsString:@"sobot:// sendFile"]){
            [ZCSobotApi sendMessageToUser:@"file:/// Users/zhangxinyao/Library/Developer/CoreSimulator/Devices/BBB98C5A-0DEB-4FBD-8EB9-8B03ACAFD49A/data/Containers/Data/Application/E2528DA6-28F5-4D1D-BCD0-C4888546C7F6/tmp/com.sobot.sdk.demo-Inbox/ces.txt " type: 4  resultBlock:^(NSString * _Nonnull  text , int  code ) {
                
            }];
            return YES;
        }
        
//        if ([linkUrl hasPrefix:@"www."]) {  // Test & debugging  Jump to root vc for use
//            TestViewController *test = [[TestViewController alloc]init];
//            UIViewController *vc = [self.class getCurrentViewController];
//            [vc presentViewController:test animated:YES completion:nil];
//            test.dismiss = ^{
//                NSLog(@"xx");
//            };
//            return YES;
//        }
        return NO;
    }];
    

1
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

# 3.4.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 (^)(SobotClientBaseController *object,ZCPlatformInfo *info))itemClickBlock;

1
2
3
4

Param

Param Name Type Description
info ZCKitInfo Set UI-related custom params
byController UIViewController VC for executing jump
delegate ZCChatControllerDelegate Chat page delegate, to implement jump from submission to the custom page
itemClickBlock void (^)(SobotClientBaseController *object,ZCPlatformInfo *info) Customize jump, you can set it to null (Note: If it's not null, no jump will be processed internally)

Sample code:


// New method
     [ZCSobotApi openZCChatListView:uiInfo with:self onItemClick:^(SobotClientBaseController * _Nonnull object, ZCPlatformInfo * _Nonnull info) {

    }];

// 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) {
                
   }];
}];
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

# 3.4.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 (^)(SobotClientBaseController *object))itemClickBlock;
    
1
2
3
4
5
6
7
8
9
10

Sketch: Image

# 3.5 End Chat


     
/// Disable the channel, clear up memory, and log out of Sobot system   Delete push
/// @param isClosePush YES Turn push off; NO Offline user, but still can receive push
[ZCSobotApi outCurrentUserZCLibInfo:NO];

1
2
3
4
5
6

# 4.1 Chatbot

# 4.1.1 Dock with the Designated Bot

Get the bot no. at backend:

Image

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";

1
2
3
4
5
6

Note: If it's not set, the default value will be used

# 4.1.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";
// 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;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

# 4.1.3 Customize Trans-to-agent Event

Method of customizing trans-to-agent event:


[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

```js
@property (nonatomic,strong)  TurnServiceBlock    turnServiceBlock;
1
2
3
4
5
6
7
8
9

Sample code:

[ZCLibClient getZCLibClient].turnServiceBlock = ^(id obj,NSString *msg,NSInteger turnType, NSString *keyword ,NSString *keywordId) {
            // Customize product info
            // ZCProductInfo *productInfo = [ZCProductInfo new];
            // productInfo.thumbUrl = @"URL";
            // productInfo.title = @"title..";
            // productInfo.desc = @"desc..";
            // productInfo.label = @"label..";
            // productInfo.link = @"your link";
            // uiInfo.productInfo = productInfo;
            // uiInfo.isSendInfoCard = YES;// Whether to auto send the product card info after trans-to-agent
        [[ZCLibClient getZCLibClient] turnServiceWithGroupId:@"groupid" Obj:obj Msg:msg KitInfo:uiInfo ZCTurnType:turnType Keyword:keyword KeywordId:keywordId];
    };
    
    // 4.0.0  New version example
     [ZCLibClient getZCLibClient].turnServiceBlock = ^(SobotChatMessage * _Nullable model, NSInteger turnType) {
        [ZCSobotApi connectCustomerService:model KitInfo:uiInfo ZCTurnType:turnType];
    };
    
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

# 4.1.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 ,
  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"}];
1
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

# 4.1.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;

1
2
3
4
5
6
7
8

# 4.1.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;

1
2
3
4
5
6

# 4.2 Agent

# 4.2.1 Dock with the Designated Skill Group

Get the skill group no. in the backend:

Image

Configure skill group ID in SDK codes:

ZCLibInitInfo *initInfo = [ZCLibClient getZCLibClient].libInitInfo;
initInfo.groupid =  @"group_ID";
1
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.

# 4.2.2 Dock with the Designated Agent

Get the designated agent ID in the backend:

Image

Image

Configure in SDK codes:

ZCLibInitInfo *initInfo = [ZCLibClient getZCLibClient].libInitInfo;
libInitInfo.choose_adminid =  @"ID";
libInitInfo.tran_flag =  @"0";
1
2
3

Note: 1 choose_adminid: Designate the docking agent. If it's not designated, the default setting will apply.

2 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, 

Note: If it's set to 1, when the designated agent is offline, it cannot transfer to other agents.

# 4.2.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:

Image

Fixed KEY custom field

// Set user custom fields
- (void)customUserInformation:(ZCLibInitInfo*)libInitInfo{
  libInitInfo.customer_fields = @{@"customField22":@"sss",
                              @"userSex":@"1",
                              @"weixin":@"weichat",
                              @"weibo":@"24566",
                              @"birthday":@"2017-06-08"};
}
1
2
3
4
5
6
7
8

User custom profile, custom key

// User custom profile
libInitInfo.params = @{@"nick":@"abc"};

1
2
3

Sketch: Image

# 4.2.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 4, // File 3, // Video
/// @param ResultBlock Sending result code == 0 indicates Sent
+ (void)sendMessageToUser:(NSString *)textMsg type:(NSInteger ) msgType resultBlock:(nonnull void (^)(NSString *, int code))ResultBlock;


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

# 4.2.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;
1
2

# 4.2.6 Set Service summary custom fields

SDK can configure custom service summary fields, so that agents can make service summary for chats more quickly.

  1. Get custom field ID

Image Image

  1. Set service summary custom fields (trans-to-agent supports passing service summary params)
 initInfo.summary_params = @{@" customField15615315349481 ":@" Field value1",@" customField15615315349482 ":@" Field value2"};
1

# 4.2.7 Set up multiple sessions API Param

When using the multi-round chat function, we will pass uid and mulitParams, two fixed custom params, for each API. uid is the unique user ID, and mulitParams is the json string of 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":@"xxyyyzzz1032"};

1
2
3

# 4.2.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 = @"Url";
//  title  Title (required)
productInfo.title = @"title";
//  desc  Digest
productInfo.desc = @"desc";
//  label  Label
productInfo.label = @"label";
//  Page URL (required) 
productInfo.link = @"send url";
kitInfo.productInfo = productInfo;



// Manually call to directly send product card
ZCProductInfo *productInfo = [ZCProductInfo new];
productInfo.thumbUrl = @"imgurl";
productInfo.title = @"title..";
productInfo.desc = @"desc..";
productInfo.label = @"label..";
productInfo.link = @"link..";
[ZCSobotApi sendProductInfo:productInfo resultBlock:nil];
1
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: Image

# 4.2.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;
1
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(ZCLinkClickType type, NSString * _Nonnull linkUrl, id  _Nullable object) {
     if ([linkUrl hasPrefix:@"sobot:// sendOrderMsg"]){
                        ZCOrderGoodsModel *model = [ZCOrderGoodsModel new];
                        model.orderStatus = 0; // New param, 0 is custom status, displaying statusCustom content
                        model.statusCustom = @"order status";
                        model.createTime = [NSString stringWithFormat:@"%.0f",[[NSDate date] timeIntervalSince1970]*1000];
                        model.goodsCount = @"3";
                        model.orderUrl  = @"your orderUrl";
                        model.orderCode = @" 1000234242342345 ";
                        model.goods =@[@{@"name":@"ccc",@"pictureUrl":@"http:// pic25.nipic.com/20121112/9252150_150552938000_2.jpg"},@{@"name":@"aaaa",@"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;
    }];
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

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;

1
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: Image

# 4.2.10 Check if merchant agent is chatting with a user (E-commerce only)

/**
*   Obtain if the corresponding merchant agent is chatting with a user
*   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];
}
1
2
3
4
5
6
7
8
9
10

# 4.2.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 = @"vip_level_1";
// You can add two or more user tags and separate these tag IDs or names by comma ","
libInitInfo.user_label = @"user_lable...";
1
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

# 4.2.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;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

# 4.2.13 Send custom cards to session records and recommend them to customers in a systematic manner

eg:

//1.Create SobotChatCustomimCard data

SobotChatCustomCard *cardModel = [[SobotChatCustomCard alloc] init];

// Configure top guide words, images, and card descriptions
cardModel.cardGuide = @"I am guiding card language, testing data...............";
cardModel.cardDesc = @"I am guiding the card content desc, testing data...............";
cardModel.cardImg = @"https://sg.sobot.io/images/books/help/logo-efa3cf68e3.png";
cardModel.cardLink = @"your cardLink";
cardModel.cardType = 1;
cardModel.isCustomerIdentity = 0;// Version 4.1.4 added (optional 0 system identity sending 1 customer identity sending)
// Configure custom click buttons
NSArray *menuTitles = @[@"look",@"sssssssssss",@"send"];
NSMutableArray *arrMenu = [[NSMutableArray alloc] init];
for(int i=0;i<3;i++){
   SobotChatCustomCardMenu *menu = [[SobotChatCustomCardMenu alloc] init];
   menu.menuTip = @"menutipClickTips";
   menu.menuLink = @"sobot://?link";
   menu.menuType = i;
   menu.menuName = sobotConvertToString(menuTitles[i]);
   menu.menuLinkType = i;
   [arrMenu addObject:menu];
}
  cardModel.cardMenus = arrMenu;
  
// Configure the middle list section of the custom card
NSMutableArray *arrInfo = [[NSMutableArray alloc] init];
for(int i=0;i<3;i++){
   SobotChatCustomCardInfo *cardInfo = [[SobotChatCustomCardInfo alloc] init];
   cardInfo.customCardName = [NSString stringWithFormat:@"1%d cardName",i];
   cardInfo.customCardThumbnail = @"https://t10.baidu.com/it/u=3829074670,206323120&fm=30&app=106&f=JPEG?w=312&h=208&s=159E7F97C67C578C3C50FCEB0300B035";
   cardInfo.customCardId = cardModel.cardId;
   cardInfo.customCardDesc = @" card description";
   cardInfo.customCardCode = @"code000cc1";
   cardInfo.customCardLink = @"your customCardLink";
   cardInfo.customCardTime = @"2023-06-09 17:11:10";
   cardInfo.customCardStatus = @"cardStatus";
   cardInfo.customCardAmountSymbol = @"¥";
   cardInfo.customCardAmount = @"6888.00";
   cardInfo.customMenus = [[NSMutableArray alloc] initWithArray:arrMenu];
   cardInfo.customCardCount = @"3";
   cardInfo.customCardQuestion = @"abc";// Version 4.1.4 added (optional robot standard questions need to be passed in when sending to robots)
   [arrInfo addObject:cardInfo];
}
            
cardModel.customCards = arrInfo;
// Configure Custom Fields
cardModel.customField = @{
 @"key1":@"value1",
 @"key2":@"value2",
 @"key3":@"value3",
 @"key4":@"value4",
 @"key5":@"value5",
 @"key6":@"value6"
};
cardModel.cardStyle = 1;
cardModel.cardId = @"orderId";
            
2.Calling the Send Custom Card API to send custom cards
[ZCSobotApi sendCustomCardToRecord:cardModel resultBlock:^(NSString * _Nonnull msg, int code) {
                
}];

1
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

# 4.3 About Submission Ticket

# 4.3.1 Set submission interface at the console

You can set submission interface at the console

Image

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;

1
2
3
4
5
6

# 4.3.2 Configure custom user info on the submission page

The verification and display logic of email, phone no., attachment in the submission can be configured at the PC console.

Image

# 4.3.3 Jump to the submission page

User can directly jump to the submission page:


ZCKitInfo *kitInfo = [[ZCKitInfo alloc] init];
kitInfo.leaveContentPlaceholder = @"sssss";
kitInfo.leaveMsgGuideContent = @"sssss";
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":@"data1"}];
kitInfo.leaveMsgGroupId = @" 540a910a760f4387918b0fa7302a0eca ";
[ZCSobotApi openLeanve:0 kitinfo:kitInfo with:self onItemClick:^(NSString *msg, int code) {
                            
     }];
1
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.: "key"="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.: "key"="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":@"sss"}
 **/
@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":@"ssss",@"params":@"city"}
 **/
@property (nonatomic,strong) NSMutableArray * leaveParamsExtends;


/**
 Submission skill group ID
 Location: Settings —> Ticket Skill Group Setting
*/
@property (nonatomic,strong) NSString * leaveMsgGroupId;

1
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.3.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:

/// Submission event interception. If this method is implemented, SDK won't process the submission event, and users can jump to their own submission page
/// @param leavePageBlock  Accessed param object
+(void)setCustomLeavePageBlock:(BOOL(^)(NSDictionary * dict))leavePageBlock;
  [ZCSobotApi setCustomLeavePageBlock:^BOOL(NSDictionary * _Nonnull dict) {
        NSLog(@"%@",dict);
        return YES;
    }];
1
2
3
4
5
6
7

# 4.3.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;
1
2
3
4
5

# 4.3.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.sg.sobot.io%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];
                            }
                        }];
1
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

# 4.3.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;

1
2
3
4
5
6
7

# 4.3.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":@"sssss"}
 **/
@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":@"ssss",@"params":@"city"}
 **/
@property (nonatomic,strong) NSMutableArray * leaveParamsExtends;


/**
 Submission skill group ID
 Location: Settings —> Ticket Skill Group Setting
*/
@property (nonatomic,strong) NSString * leaveMsgGroupId;


1
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

# 4.4 Evaluation

# 4.4.1 Set evaluation interface

You can set satisfaction evaluation interface at the console

Image

# 4.4.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;

1
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:

ImageImage

# 4.4.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;

1
2
3
4
5
6
7
8

# 4.4.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;

1
2
3
4
5
6
7
8

# 4.4.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;

1
2
3
4
5
6
7

# 4.5 About Message

# 4.5.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.

  1. When generating the appkey, upload the push certificate (.p12 format), and export the certificate with a password;

  2. 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;
1
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)
1
2
3

Adopted protocol


<UIApplicationDelegate,UNUserNotificationCenterDelegate>

1
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];

}
1
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

# 4.5.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 
[ZCSobotApi setShowDebug:YES]; 

1
2
3
4
5
6

# 4.5.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){

    };
    
// 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];
1
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.5.4 Unread message operation

// Directly get unread messages
[ZCSobotApi getUnReadMessage]
// Clear unread messages
 [ZCSobotApi clearUnReadNumber:@"partnerid"];
1
2
3
4

# 4.5.5 Send location message

Send location message. 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:@"aaa"];
        menu1.url = [NSString stringWithFormat:@"sobot:// sendlocation"];;
        menu1.imgName = @"zcicon_sendlocation";
        [arr addObject:menu1];
        ZCLibCusMenu *menu2 = [[ZCLibCusMenu alloc] init];
        menu2.title = [NSString stringWithFormat:@"shop"];
        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":@"ss....",
                        @"localName":@"name...",
                        @"file":fullPath}];
1
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

# 4.5.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(ZCLinkClickType type, NSString * _Nonnull linkUrl, id  _Nullable object) {
        return NO;
    }];
1
2
3
4
5
6

Intercept links clicked by users in messages

# 4.5.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) {
       
        
    }];
    
    
/// Monitor clicking Back function event. Use setFunctionClickListener to replace
/// @param backBlock id current viewcontroller, type: Help Center, submission, chat, chat list
+(void)setZCViewControllerBackClick:(void (^)(id currentVC,ZCPageCloseType type))backBlock;
    
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

# 4.5.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;

1
2
3
4
5
6
7
8
9

# 4.5.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;


1
2
3
4
5
6
7
8
9
10

# 4.5.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;


1
2
3
4
5
6
7
8

# 4.6 Customize UI settings

  1. We support customizing the color and font color in navigation bar area;
  2. 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;
  3. We support customizing the bottom background color and input box line background color in the bottom area;
  4. 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).
  5. 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.

# 4.6.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, ZCPageStateType type) {
        }];


1
2
3
4
5
6
7
8
9
10
11
12

[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]

# 4.6.2 Customize top title

/**
 *   V4.0.0 Start Customize chat page top title Avatar, agent nickname, enterprise name
 *   Default as PC console Setting   Method 1: Display reception agent + enterprise name, Method 2: Display enterprise information + reception status
 *   If you tend to set custom control in SDK, you should simultaneously set:  1. Whether to display the avatar ON/OFF; 2. Whether to display enterprise name ON/OFF; 3. Whether to display agent nickname ON/OFF. If one of these three is not set, the setting in the PC console will be taken by default
 *
 *
 *    The original title_type is in use
 *   
 */

// The following attributes are in ZCKitInfo class
/// Whether to display the custom image on the top of chat page, NO by default. Follow the PC ON/OFF setting
@property(nonatomic,assign) BOOL isShowTitleViewImg;

/**
 *  Custom image of chat page top title, which should be used with isShowTitleViewImg
*/
@property(nonatomic,strong) NSString *custom_title_url;

/// Whether to display the custom reception agent nickname on the top of chat page, NO by default. Follow the PC ON/OFF setting
@property(nonatomic,assign) BOOL isShowTitleViewNick;

/**
 *  Custom reception agent nickname of chat page top title, which should be used with isShowTitleViewNick
*/
@property(nonatomic,strong) NSString *custom_nick_title;

/// Whether to display the custom enterprise name on the top title of chat page, NO by default. Follow the PC ON/OFF setting
@property(nonatomic,assign) BOOL isShowTitleViewCompanyName;

/**
 * Custom enterprise name of chat page top title, which should be used with isShowTitleViewCompanyName
 *   If isShowTitleViewCompanyName, custom_company_title is passed in null and takes the PC setting
*/
@property(nonatomic,strong) NSString *custom_company_title; 

1
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

# 4.7 Other Configuration

# 4.7.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 of user timeout
    libInitInfo.user_tip_word = @"";
    // Agent prompt
    libInitInfo.admin_tip_word = @"";
    // Bot Greeting
    libInitInfo.robot_hello_word = @"";
    // Reply of no agent online
    libInitInfo.admin_offline_title = @"";
    // Agent Greeting
    libInitInfo.admin_hello_word  = @"";
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14

# 4.7.2 Customize chat history display time range

If you want to set chat history within xx 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;
1
2
3
4
5

# 4.7.3 "+" panel menu extension

  1. 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;

1
2
3
4
5
6
7
8
  1. 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:@"shop"];
        menu2.url = [NSString stringWithFormat:@"sobot:// sendProductInfo"];
        menu2.imgName = @"zcicon_sendpictures";
        
        [arr addObject:menu2];
    }
    
    
    uiInfo.cusMoreArray = arr;
    
    uiInfo.cusRobotMoreArray = arr;
1
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 :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 * cusRobotMoreArray;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

# 4.7.4 Call the dial interface API

/**
 *  setting 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;
1
2
3
4
5
6
7
8
9
10
11
12

# 4.7.5 Sobot log display ON/OFF

/**
 *  Display log information
 *
 *  @param isShowDebug Not display by default
 */
+(void) setShowDebug:(BOOL) isShowDebug;
1
2
3
4
5
6

# 4.7.6 iOS multi-language support

At present, the SDK supports two languages, English and Chinese. 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]


// 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;



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

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;





1
2
3
4
5
6
7
8
9
10
11

# 4.7.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;

1
2
3
4
5
6
7
8
9

# 4.7.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];

1
2
3

# 4.7.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
  
    }];

1
2
3
4
5
6

# 5 Configuration Class Attribute Description

# 5.1 ZCKitInfo class description (UI-related configuration)

It can be reset every time when the Sobot page is initiated

# About UI logic:

Attribute name Data Type Description Note
isOpenEvaluation BOOL Whether to turn on satisfaction evaluation upon clicking Back NO (OFF) by default
isCloseAfterEvaluation BOOL After turning on satisfaction evaluation upon clicking Back, whether to close the chat after agent evaluation NO (OFF) by default
isShowTelIcon BOOL 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 Whether to display Evaluation button on the top right corner of the navigation bar Not display by default
customTel NSString When Dial button is displayed on the top right corner of the navigation bar (it's valid when setting together with isShowTelIcon)
isOpenRecord BOOL Whether to turn on the voice function (In agent reception mode) YES (ON) by default.
isSetPhotoLibraryBgImage BOOL Whether to set album background image (If not set, it will follow the navigation color setting)
isOpenRobotVoice BOOL Whether to enable bot voice (It's required to enable; otherwise bot cannot recognize voice)
navcBarHidden BOOL On SDK page, use the customized navigation bar, instead of the system navigation bar (hidden)
canSendLocation BOOL 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 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 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 Product information, used with isSendInfoCard
isShowCloseSatisfaction BOOL Whether to display the evaluation interface upon clicking Close button. Not display by default
isShowReturnTips BOOL 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 Hide BottomBar after push YES by default
isShowPortrait BOOL Support portrait mode only NO by default
isCloseInquiryForm BOOL Whether to close the pre-query form (NO by default, follow the system default configuration)
isShowClose BOOL 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 Whether to use images in .xcassets NO (OFF) by default
autoSendOrderMessage BOOL After trans-to-agent, whether to actively send a message
isEveryTimeAutoSend BOOL Whether to send order information every time. You have to first set the param autoSendOrderMessage = YES.
orderGoodsInfo ZCOrderGoodsModel Order information to be sent, used with autoSendOrderMessage
leaveCompleteCanReply BOOL After submission is done, whether to display Reply button. YES by default, you can reply.
hideMenuSatisfaction BOOL Function in the "+" at the bottom of chat page: Hide evaluation NO (not hide) by default
hideMenuLeave BOOL Submission (agent and bot) in the "+" at the bottom of chat page NO (not hide) by default
hideMenuManualLeave BOOL Submission (agent only) in the "+" at the bottom of chat page NO (not hide) by default
hideMenuPicture BOOL Function in the "+" at the bottom of chat page: Hide photos NO (not hide) by default
hideMenuCamera BOOL Function in the "+" at the bottom of chat page: Hide camera NO (not hide) by default
hideMenuFile BOOL Function in the "+" at the bottom of chat page: Hide files NO (not hide) by default
themeStyle BOOL Whether to set to dark mode, 2: standard mode; 1: dark mode; 0: follow the system settings. It's 0 by default
useDefaultDarkTheme BOOL 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 Customize submission content preset text
leaveMsgGuideContent NSString Customize submission guidance text
leaveCusFieldArray NSMutableArray Directly enter the submission custom field
leaveMsgGroupId NSString Get submission skill group ID: Settings —> Ticket Skill Group Setting
hideChatTime BOOL Whether to hide chat time NO by default
hideRototEvaluationLabels BOOL Whether to hide bot evaluation tag NO (not hide) by default
hideManualEvaluationLabels BOOL Whether to hide agent evaluation tag NO (not hide) by default
helpCenterTel NSString In Help Center, phone no. can jump to the dialing interface. Not display by default
helpCenterTelTitle NSString Phone no. display content in Help Center Not display by default
showPhotoPreview BOOL 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 Submission template ID [Note: it's used with ZCChatControllerDelegate]
hideNavBtnMore BOOL Whether to hide the "..." More button on the top right corner of navigation NO (not hide) by default
hideQRCode BOOL Whether to disable the QR code identification function. YES (OFF) by setting, NO (ON) by default

# About font:

Attribute name Data Type Description Note
titleFont UIFont Top title font
subTitleFont UIFont Subtitle font
listTitleFont UIFont List title font
listDetailFont UIFont Unread message button & evaluation tag font
listTimeFont UIFont Message reminder (time, trans-to-agent, agent reception etc.) font
chatFont UIFont Chat bubble text font
voiceButtonFont UIFont Record button text font
goodsTitleFont UIFont Title font in product details cell
goodsDetFont UIFont Digest font in product details cell
scTopTextFont UIFont Help Center title font

# About background color:

Attribute name Data Type Description Note
goodSendBtnColor UIColor btn background color in product details cell
backgroundColor UIColor Chat page background color
leftChatColor UIColor Left chat bubble color
rightChatColor UIColor Right chat bubble color
leftChatSelectedColor UIColor Left bubble selected copy color
rightChatSelectedColor UIColor Right bubble selected copy color
bottomLineColor UIColor Bottom frame edge/line color (input box, record button, separator)
commentCommitButtonColor UIColor Evaluation submission button background color
commentItemButtonBgColor UIColor Evaluation option button default color (follow the theme color by default)
commentItemButtonSelBgColor UIColor Evaluation option button selected color (follow the theme color by default)
videoCellBgSelColor UIColor Voice cell selected background color
LineRichColor UIColor Line color in rich text
goodSendBtnColor UIColor Product Send button background color
leaveSubmitBtnImgColor UIColor Submit button background color on the submission page
topViewBgColor UIColor Custom navigation bar background color
scTopBgColor UIColor Help Center navigation bar background color
documentLookImgProgressColor UIColor File View, ImgProgress image background color
documentBtnDownColor UIColor File View, button background color
notificationTopViewBgColor UIColor Announcement bar background color
satisfactionSelectedBgColor UIColor Resolved and "Unresolved" background color on the evaluation page

# About text color:

Attribute name Data Type Description Note
topViewTextColor UIColor Top text color
leftChatTextColor UIColor Left bubble text color
rightChatTextColor UIColor Right bubble text color
chatTextViewColor UIColor Input box text color
timeTextColor UIColor Time text color
chatLeftLinkColor UIColor Left bubble link color
chatRightLinkColor UIColor Right bubble link color
satisfactionTextColor UIColor Chat end text color after evaluation is submitted
noSatisfactionTextColor UIColor Not Evaluate Now text color
satisfactionTextSelectedColor UIColor Resolved and "Unresolved" text color on the evaluation page
scoreExplainTextColor UIColor Satisfaction star level description text color
commentButtonTextColor UIColor Evaluation (condition selection button) text color (follow the theme color by default)
submitEvaluationColor UIColor Submit Evaluation button text color
notificationTopViewLabelColor UIColor Announcement bar text color
leaveSubmitBtnTextColor UIColor Submit button text color on the submission page
scTopTextColor UIColor In Help Center, navigation title text color

# About image:

Attribute name Data Type Description Note
topBackNolImg NSString Back button default status image

# Miscellaneous:

Attribute name Data Type Description Note
cusMoreArray NSMutableArray 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 ( Initialization linkBock)  imgName:Local Image Name. eg:xxx@2x.png,icon=xxx
cusMenuArray NSMutableArray 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 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

# 5.2 ZCLibInitInfo class description

This object will be created automatically after initialization, and can be used directly later

# About ID:

Attribute name Data Type Description Note
topBackNolImg NSString Back button default status image
api_host NSString API host If you use localized deployment, please use your deployed server domain name.
app_key NSString Setting is required; if not, initialization will fail. Initialization will auto assign a value Required
choose_adminid NSString Designate agent ID
tran_flag int Designate agent transfer type 0: Transfer to any agent; 1: Transfer to the designated agent alone
partnerid NSString User's unique ID It is docked with the user's reliable identity, and 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 Docking bot ID
robot_alias NSString Docking bot ID alias. If you set this value, you have to set robotid to null every time
platform_userid NSString Platform channel param, auto assign after initialization
platform_key NSString Private key
sign NSString Signature MD5 (app_key+partnerid+secret+create_time) Use it when you need to sign
create_time NSString Timestamp for signing

E-commerce:

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.

Attribute name Data Type Description Note
customer_code NSString Merchant docking ID (E-commerce only. In case of no app_key, it must be provided)
flow_type int 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 Transfer receiving company ID
flow_groupid NSString Transfer receiving company skill group

# Agent workbench display:

Attribute name Data Type Description Note
user_nick NSString Nickname
user_name NSString Real Name
user_tels NSString User's phone no.
user_emails NSString User's e-mail
qq NSString qq
remark NSString Note
face NSString User's custom avatar
visit_title NSString Accessed source page title
visit_url NSString Accessed source URL
params NSDictionary User profile
customer_fields NSDictionary Fixed KEY custom field. All keys take effect after console settings (Settings -> Custom Fields -> User Info Fields) @{@"customField22":@"value"};
group_name NSString Skill Group Name
groupid NSString Skill group no.
isVip NSString 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 Designate customer VIP level, pass a level Same as PC Settings - Custom Fields - Customer Fields
enterprise_name NSString Company name

# About reply:

Attribute name Data Type Description Note
admin_hello_word NSString Custom agent greeting, blank by default (If any field is passed, the field will be used first)
robot_hello_word NSString Custom bot greeting, blank by default (If any field is passed, the field will be used first)
user_tip_word NSString Custom user timeout prompt, blank by default (If any field is passed, the field will be used first)
admin_offline_title NSString Custom reply of agent offline, blank by default (If any field is passed, the field will be used first)
admin_tip_word NSString Custom agent timeout prompt, blank by default (If any field is passed, the field will be used first)
user_out_word NSString Custom prompt of user timeout & offline, blank by default (If any field is passed, the field will be used first)

# About chat page:

Attribute name Data Type Description Note
service_mode int Customize access mode: 1. Bot only 2. Agent only 3. Intelligent Agent - Bot first 4. Intelligent Agent - Agent first
title_type NSString Customize chat page top title: 0. By default, 1. Enterprise name, 2. Custom fields, 3. Display text only, 4. Display avatar and text.
custom_title NSString Chat page top title Custom field
custom_title_url NSString Custom image path
scope_time int History time range, in minute (E.g.: 100- means the chat history in the latest 100min)
notifition_icon_url NSString Announcement icon URL
faqId int Designate guidance text. Set specific guidance texts for different users

# Miscellaneous:

Attribute name Data Type Description Note
is_enable_hot_guide BOOL Whether to permit requesting hotspot guidance question API
margs NSDictionary Extension field of hotspot guidance questions
support BOOL Whether bot Q&A supports word association
transferaction NSArray Trans-to-agent Designated skill group Overflow 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: 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 "}]
summary_params NSDictionary Trans-to-agent custom field key: @{@"customField15619769556831":@"xxyyyzzz1032"};
multi_params NSDictionary Multi-round chat Custom field
good_msg_type int 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 Auto send product order info
queue_first int Designated customer first
default_language NSString 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 It's used only when the system language cannot be identified
absolute_language NSString Designate a language, which will not auto switch by following the system language.

# 6 Sobot SDK resource library source code and function experience Demo

      Sobot iOS_SDK UI source code (opens new window);
Sobot SDK function experience Demo APP download (opens new window) Use video guidance

# 7 FAQ

Please click link (opens new window) to enter the intelligent bot page and enter your question

# 8 Update Description

Sobot iOS_SDK Version Update Description (opens new window)

# 9 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)

Last Updated: 11/19/2024, 2:16:47 PM
Update Date
01
Live Chat Statistics API
04-23
02
Operations Support API
04-03
03
CRM Docking Scheme
12-05
More Articles>
Theme by Vdoing
  • Follow Sys
  • Line
  • Dark
  • Read