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

  • Live Chat API
  • Chatbot API
  • Agent Component SDK

    • Android SDK
    • iOS 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
    • Text Product API
    • Agent Component SDK
    Sobot
    2022-05-19
    Menus

    iOS SDK

    # iOS Integration Description

    Sobot SDK provides the capability of APP access to reception agents. Simply embedded, it can monitor and process customer inquiries in real time. Online customer reception can also be achieved on the mobile phone without downloading the Sobot APP.

    Live chat SDK has the following features:

    • Online inquiry: Agents can send or receive images, videos, emojis and other messages in real-time chats with customers.
    • User follow, smart reply, quick reply, chat summary, user evaluation invitation.
    • Highly customized UI.

    Related limits and notes:

    1. The new iOS SDK supports versions above iOS8.

    2. The released XCode version is XCode 12.0. 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 and photo permissions; otherwise, some functions are not available.

    # File Introduction

    # ● Schematic Diagram of Integration Process

    Image

    # ● File Description

    SDK files include SobotOnline.framework and SobotOnline.bundle, SobotDemo, and Doc related documentation.

    File Description
    SobotOnline.framework Sobot SDK code library
    SobotOnline.bundle SDK resource library, containing image files, multilingual files and colors
    SobotOnlineService.h Key function operation class
    SobotOnlineConfig.h Function configuration class
    SobotCache.h Basic frame setting class
    # ● Permission Description

    Permission required for using live chat SDK:

    
    <key>NSCameraUsageDescription</key>
      &lt;String&gt;Your camera will be accessed to send photos</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

    # Integration Method

    # ● Manual Integration

    Download Link:

    Download and unzip iOS_OnlineSDK (opens new window), and add SobotOnline.framework and SobotOnline.bundle to your project.

    # ● CocoaPods Integration

    Integrate the codes and add them to podfile:

    pod 'SobotOnlineSDK'
    
    
    1
    2

    If the library cannot be found, please clear pod cache:

    
    // Latest version not found
    pod cache clean --all
    rm -rf ~/Library/Caches/CocoaPods
    pod repo update
    
    Delete the pod file folder in the code,
    pod cache clean plug-in name
    and then pod install
    
    1
    2
    3
    4
    5
    6
    7
    8
    9

    # Function Description

    # ● Initialization and Domain Name Settings

    [Note: Contact the Sobot after-sales service personnel for appid and app_key. If you access with token, please refer to API File to get token (opens new window)]

    Domain name description:

          * If you use localized deployment, please use your deployed server domain name.

    Method 1: Initialize SDK with appid and appkey.

    Sample code:

    
    /// Initialize SDK, set the domain name, and get token
    /// @param appid Company appid
    /// @param appkey Merchant appkey
    /// @param host  It can be blank, and Alibaba Cloud server is set by default; If necessary, please set your own domain name
    +(void)initWithAppid:(NSString *) appid appkey:(NSString *) appkey host:(NSString * __nullable) host result:(void (^)(id object))resultBlock;
    
    // lg:
    [SobotOnlineService initWithAppid:@"Your appid" appkey:@"Your appkey" host:@"your host" result:^(id  _Nonnull object) {
        
    }];
        
        
        
        
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15

    Method 2: Initialize SDK with token.

    
    /// Initialize SDK, set the domain name and authentication token
    /// @param token Authentication token
    /// @param host  It can be blank, and Alibaba Cloud server is set by default; If necessary, please set your own domain name
    /// @param resultBlock Return result
    +(void)initWithToken:(NSString *) token host:(NSString * __nullable) host result:(void (^)(id object))resultBlock;
        
    
    1
    2
    3
    4
    5
    6
    7
    # ● Resource Deployment

    Optional. The following value are set by default, and the resource library can be customized.

    
    // Designate the loaded bundle name, with SobotOnline by default
        [SobotCache shareSobotCache].sobotCacheEntity.bundleName = @"SobotOnline";
       
    // Designate the loaded color file name, with SobotColor by default
        [SobotCache shareSobotCache].sobotCacheEntity.colorTableName = @"SobotColor";
        
        
    
    1
    2
    3
    4
    5
    6
    7
    8
    # ● Initiate Page

    See Demo call code for details. The main call codes are as follows:

    [Note: Before initiating the page, the initialization API initWithAppid must be called; otherwise, the initiation will fail.]

    API:

    
    
    
    /// Initiate agent authentication page
    /// @param account Agent account (email)
    /// @param loginStatus Login status 2:occupied, 1:online, 0: default
    /// @param byController  Initiated controller
    +(void)startAuthWithAcount:(NSString *) account status:(int) loginStatus vc:(UIViewController *) byController result:(void (^)(id object))resultBlock;
     
            
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10

    Param:

    Param Type Required Description
    account NSString Yes Agent Email
    status int Yes -1: Not on top, 0: occupied, 1:online.
    resultBlock Block No Initiate result status callback

    Sample code:

    
    #import <SobotOnline/SobotOnline.h>
    
    [SobotOnlineService startAuthWithAcount:@"your acount" status:1 vc:self result:^(id  _Nonnull object) {
        
    }];
    
    
    1
    2
    3
    4
    5
    6
    7
    # ● API Description
    # 1. Log in

    Mute online agents. If the agent is in online status after login, it can receive the real-time message monitoring.

    
    #import <SobotOnline/SobotOnline.h>
    
    
    /// Log in the agent only, without implementing page logic
    /// @param account Agent account (email)
    /// @param loginStatus Login status 2:occupied, 1:online, 0: default
    /// @param resultBlock Login result
    [SobotOnlineService doLoginWithAccount:@"your account" status:1 result:^(id  _Nonnull object) {
        
    }];
    
    
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    # 2. Log out

    Log out the current agent.

    
    #import <SobotOnline/SobotOnline.h>
    
    
    /// Manually log out the agent
    [SobotOnlineService outAdmin];
    
    
    1
    2
    3
    4
    5
    6
    7

    # 3. Get unread messages

    Get the current total number of unread messages. Local unread messages will be cleared when logging in again.

    
    #import <SobotOnline/SobotOnline.h>
    
    
    /// Get unread messages
    int num = [SobotOnlineService getUnReadNumber];
    
    
    1
    2
    3
    4
    5
    6
    7
    # 4. Set Message Monitoring

    Monitor with either proxy method or block method.

    
    #import <SobotOnline/SobotOnline.h>
    
    // With block method
    [SobotOnlineService setReceiveMessageBlock:^(id message, int nleft, NSDictionary *object) {
        
    }];
        
    // Set proxy method
    [SobotOnlineService setReceiveMessageDelegate:self];
        
        
        
        
    // Set message link and click Monitor; when Yes is returned, it should be processed by yourself instead of the internal
    [SobotOnlineService setSobotLinkBlock:^BOOL(id object, NSString *linkUrl) {
        if([linkUrl isEqual:@"myurl"]){
            // do something
            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
    # 5. Function Configuration

    Configure some functions, colors, and functional display with attributes. It is unavailable now.
    For example (whether to remind automatically):

    
        SobotOnlineConfig *config = [SobotOnlineService getCurOnlincConfig];
        config.autoNotifaction = YES;
        [SobotOnlineService configSobotOnline:config]; 
     
    
    1
    2
    3
    4
    5

    # Source Code and Demo

    Download the Demo source code (opens new window);

    # 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

    ← Android SDK Message Push→

    Update Date
    01
    Operations Support API
    04-03
    02
    CRM Docking Scheme
    12-05
    03
    AI Agent API
    09-09
    More Articles>
    Theme by Vdoing
    • Follow Sys
    • Line
    • Dark
    • Read