### Start Call System Source: https://developer.zhichi.com/pages/abeea4 Methods to directly start the call system, automatically logging in and navigating to the homepage. ```APIDOC ## Start Call System ### Description Methods to directly start the call system, automatically logging in and navigating to the homepage. ### Methods 1. **startWithAcount** * **Description**: Start the call system using email and password for login. * **Parameters**: * `context` (Context) - Required - Application context. * `loginUser` (String) - Required - Customer service account. * `loginPwd` (String) - Required - Login password. * `block` (SobotResultBlock) - Optional - Callback for results. 2. **startWithToken** * **Description**: Start the call system using a company token for login. * **Parameters**: * `context` (Context) - Required - Application context. * `loginUser` (String) - Required - Customer service account. * `companyToken` (String) - Required - Company token. * `block` (SobotResultBlock) - Optional - Callback for results. 3. **startWithAppkey** * **Description**: Start the call system using appKey and appId for login. * **Parameters**: * `context` (Context) - Required - Application context. * `loginUser` (String) - Required - Customer service account. * `appKey` (String) - Required - Login appKey (obtain from after-sales). * `appId` (String) - Required - Login appId (obtain from after-sales). * `block` (SobotResultBlock) - Optional - Callback for results. ``` -------------------------------- ### Example: Create Ticket with User Info Source: https://developer.zhichi.com/pages/c3506b Example code demonstrating how to populate parameters for opening the create ticket page, including user name and ID validation. ```java Map param = new HashMap<>(); if (TextUtils.isEmpty(userid.getText().toString())){ if(!TextUtils.isEmpty(nick.getText().toString())){ SobotToastUtil.showCustomToast(getSobotActivity(),"如果输入昵称,但是用户id为空,对应客户是也是空的,无效的"); } }else{ if(SobotStringUtils.isEmpty(nick.getText().toString())){ SobotToastUtil.showCustomToast(getContext(),"用户昵称不能为空"); return; } param.put("userName", nick.getText().toString()); param.put("userId", userid.getText().toString()); } } SobotOrderApi.openCreateWorkOrder(getSobotActivity(), param, null); ``` -------------------------------- ### Query Agent States Example (JavaScript) Source: https://developer.zhichi.com/pages/2ccbcf Shows how to use the `agent.queryStates` function to retrieve a list of available agent states. The example includes success and error callbacks. ```javascript agent.queryStates({ success: function(event) { // do something ... }, error: function(cause) { // Error, can't go on... }, }) ``` -------------------------------- ### Start Call Page - Method 3 (AppKey and AppID) Source: https://developer.zhichi.com/pages/9cb214 Starts the call page using AppKey and AppID for authentication, automating the login process. ```APIDOC ## POST /websites/developer_zhichi ### Description Initiates the Sobot SDK call page using AppKey and AppID for authentication. This method automatically handles the login process. ### Method POST ### Endpoint /websites/developer_zhichi ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **account** (NSString) - Required - The customer service account. - **app_key** (NSString) - Required - The application's AppKey. - **appid** (NSString) - Required - The application's AppID. - **vc** (UIViewController) - Required - The view controller to perform the navigation. - **resultBlock** (Block) - Optional - A callback block that receives the execution result (code=1 for success). ### Request Example ```objc [SobotTMApi startWithAcount:@"your_account" appkey:@"your_appkey" appid:@"your_appid" viewController:self result:^(NSInteger code, id _Nullable obj, NSString * _Nullable msg) { // Handle result }]; ``` ### Response #### Success Response (200) - **code** (NSInteger) - Indicates success (1) or failure. - **obj** (id) - Additional object data. - **msg** (NSString) - A message describing the result. #### Response Example ```json { "code": 1, "obj": null, "msg": "Success" } ``` ``` -------------------------------- ### 注册远程推送 Source: https://developer.zhichi.com/pages/94e45d 在`didFinishLaunchingWithOptions`方法中添加注册远程推送的代码,根据iOS版本选择不同的注册方式。 ```APIDOC ## 注册远程推送 ### 描述 注册远程推送,以便接收和处理推送通知。 ### 示例代码 ```objc // iOS10 以上 if (@available(iOS 10.0, *)) { UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; [center requestAuthorizationWithOptions:(UNAuthorizationOptionAlert + UNAuthorizationOptionSound) completionHandler:^(BOOL granted, NSError * _Nullable error) { }]; } else { // iOS8.0 以上 UIUserNotificationSettings *setting = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert categories:nil]; [[UIApplication sharedApplication] registerUserNotificationSettings:setting]; } ``` ``` -------------------------------- ### Get Recording URL Example (GET Request) Source: https://developer.zhichi.com/pages/e649f1 This example shows how to retrieve an audio recording using a GET request. It requires an Authorization header with an agent-level token and provides a sample URL endpoint. The response is the raw MP3 audio stream. ```http GET https://openapi.soboten.com/callservice/v6/cc-audios/recordings/e4d15cfb03ad5N4b7639244F8782000fb764 Authorization: Bearer ``` -------------------------------- ### Get Reception Overview Trend API Response Example Source: https://developer.zhichi.com/pages/z91mkr This snippet provides an example of a successful response from the Get Reception Overview Trend API. It includes fields such as return code, message, and a list of items containing detailed daily and hourly reception statistics. ```json { "ret_code": "000000", "ret_msg": "成功", "items": [ { "result_day": "2023-07-24", "result_hour": "0.00%", "robot_consult": 0, "robot_valid": 0, "robot_in_valid": 0, "robot_self": 0, "robot_solved": 0, "robot_not_solved": 0, "evaluate_robot": 0, "satisfied": 0, "dissatisfied": 0, "evaluate_robot_invites": 0, "robot_transfer_to_staff_total": 0, "robot_valid_to_staff": 0, "robot_of_visitor_direct_transfer": 0, "robot_transfer_succ_total": 0, "robot_valid_transfer_succ": 0, "robot_direct_transfer_succ": 0, "robot_transfer_faild_total": 0, "robot_valid_transfer_falid": 0, "robot_direct_transfer_falid": 0, "robot_valid_consult_rate": 0.0, "robot_valid_consult_rate_str": "0.00%", "robot_in_valid_rate": 0.0, "robot_in_valid_rate_str": "0.00%", "robot_self_rate": 0.0, "robot_self_rate_str": "0.00%" } ] } ``` -------------------------------- ### SDK Initialization Source: https://developer.zhichi.com/pages/abeea4 Initialize the SDK and set the domain. ```APIDOC ## SDK Initialization ### Description Initialize the SDK and set the domain. ### Method * **initWithConfig** * **Description**: Initializes the SDK with configuration. * **Parameters**: * `application` (Application) - Required - The application context. * `config` (SobotCallConfigEntity) - Required - Initialization parameters. * `block` (SobotResultBlock) - Optional - Callback function for API calls. ### Initialization Parameters (SobotCallConfigEntity) | Field | Name | Type | Required | | --------------- | ------------------------ | ------ | -------- | | `openApiHost` | General API Service Address | String | No | | `callApiHost` | Call API Service Address | String | No | | `stompSocketUri`| Agent Signaling Service | String | No | | `janusSocketUri`| Janus Message Listener | String | No | | `sipProxy` | Janus Proxy Service | String | No | ### Callback Callback function details can be found in `SobotResultBlock`. ``` -------------------------------- ### Get Task Type List Response (Example) Source: https://developer.zhichi.com/pages/a9c8dc Example response for the 'get_task_type_list' endpoint, showing a list of task types with their IDs and names. ```json { "items": [ { "taskTypeName": "551111", "taskTypeId": "b3bb75b1-cfc4-464b-9137-1509c4e61bf8", "taskCreateTime": null, "taskUpdateTime": null } ], "retCode": "000000", "retMsg": "操作成功" } ``` -------------------------------- ### Start Order Homepage - Method 2 (Using Token) Source: https://developer.zhichi.com/pages/f94c16 Launches the order SDK homepage using a provided token for authentication. Optionally uses account and password if the token is not provided. ```APIDOC ## POST /websites/developer_zhichi/startOrderHomepageToken ### Description Starts the SDK's order homepage using a company token for authentication. If the token is not provided, it can use the account and password to log in. ### Method POST ### Endpoint /websites/developer_zhichi/startOrderHomepageToken ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **token** (NSString) - Optional - Company token (loginWithCommpanyToken is recommended). - **account** (NSString) - Required - Account for login. - **vc** (UIViewController) - Required - The view controller to perform the jump. - **resultBlock** (SobotResultBlock) - Optional - Callback for the execution result (code=1 indicates success). ### Request Example ```json { "token": "company_token", "account": "customer_account", "vc": "current_view_controller", "resultBlock": "callback_block" } ``` ### Response #### Success Response (200) - **code** (NSInteger) - Indicates the result of the operation (1 for success). - **obj** (id) - Additional data returned by the callback. - **msg** (NSString) - A message describing the result of the operation. #### Response Example ```json { "code": 1, "obj": null, "msg": "Operation successful" } ``` ``` -------------------------------- ### Get Department Details Response (Example) Source: https://developer.zhichi.com/pages/a9c8dc Example response for retrieving department details. The 'item' field may contain department information or be null if not found. ```json { "retCode": "000000", "retMsg": "操作成功", "item": null } ``` -------------------------------- ### Get Transfer to Staff Statistics API Response Example Source: https://developer.zhichi.com/pages/z91mkr This is an example of a successful response from the GetTransferToStaffStatistics API. It contains a status code, message, and a detailed 'item' object with various statistical metrics. ```json { "ret_code": "000000", "ret_msg": "成功", "item": { "robot_consult": 13, "robot_transfer_to_staff_total": 7, "robot_transfer_to_staff_total_rate": 0.5384615384615384, "robot_transfer_to_staff_total_rate_str": "53.85%", "robot_transfer_to_staff_total_pre": 8, "robot_transfer_to_staff_total_ratio": -0.13, "robot_transfer_to_staff_total_ratio_str": "-13.00%", "robot_valid_to_staff": 2, "robot_valid_to_staff_total_consult_rate": 0.15384615384615385, "robot_valid_to_staff_total_consult_rate_str": "15.38%", "robot_valid_to_staff_total_transfer_rate": 0.2857142857142857, "robot_valid_to_staff_total_transfer_rate_str": "28.57%", "robot_valid_to_staff_pre": 0, "robot_valid_to_staff_ratio": 0.0, "robot_valid_to_staff_ratio_str": "0.00%", "robot_of_visitor_direct_transfer": 5, "robot_direct_transfer_total_consult_rate": 0.38461538461538464, "robot_direct_transfer_total_consult_rate_str": "38.46%", "robot_direct_transfer_total_transfer_rate": 0.7142857142857143, "robot_direct_transfer_total_transfer_rate_str": "71.43%", "robot_of_visitor_direct_transfer_pre": 8, "robot_of_visitor_direct_transfer_ratio": -0.38, "robot_of_visitor_direct_transfer_ratio_str": "-38.00%", "robot_to_staff_active": 7, "robot_to_staff_active_total_consult_rate": 0.5384615384615384, "robot_to_staff_active_total_consult_rate_str": "53.85%", "robot_to_staff_active_total_transfer_rate": 1.0, "robot_to_staff_active_total_transfer_rate_str": "100.00%", "robot_to_staff_active_pre": 8, "robot_to_staff_active_ratio": -0.13, "robot_to_staff_active_ratio_str": "-13.00%", "robot_to_staff_active_direct": 0, "robot_to_staff_active_direct_total_consult_rate": 0.0, "robot_to_staff_active_direct_total_consult_rate_str": "0.00%", "robot_to_staff_active_direct_total_transfer_rate": 0.0, "robot_to_staff_active_direct_total_transfer_rate_str": "0.00%", "robot_to_staff_active_direct_pre": 0, "robot_to_staff_active_direct_ratio": 0.0, "robot_to_staff_active_direct_ratio_str": "0.00%", "robot_to_staff_active_apprehend": 0, "robot_to_staff_active_apprehend_total_consult_rate": 0.0, "robot_to_staff_active_apprehend_total_consult_rate_str": "0.00%", "robot_to_staff_active_apprehend_total_transfer_rate": 0.0, "robot_to_staff_active_apprehend_total_transfer_rate_str": "0.00%", "robot_to_staff_active_apprehend_pre": 0, "robot_to_staff_active_apprehend_ratio": 0.0, "robot_to_staff_active_apprehend_ratio_str": "0.00%", "robot_to_staff_active_guide": 0, "robot_to_staff_active_guide_total_consult_rate": 0.0, "robot_to_staff_active_guide_total_consult_rate_str": "0.00%", "robot_to_staff_active_guide_total_transfer_rate": 0.0, "robot_to_staff_active_guide_total_transfer_rate_str": "0.00%", "robot_to_staff_active_guide_pre": 0 } } ``` -------------------------------- ### Startup Zhichi Page Source: https://developer.zhichi.com/pages/6d874b Provides three methods to start the telemarketing system and automatically log in, redirecting to the page. ```APIDOC ## ● Start Zhichi Page ### Method 1: Direct Startup This method directly starts the telemarketing system, automatically completes login, and redirects to the page. #### API Endpoints * **Start with Account:** * **Description:** Starts the telemarketing system and enters the homepage using email and password. * **Method:** `SobotTMApi.startWithAcount(Context context, String loginUser, String loginPwd, SobotResultBlock block)` * **Parameters:** * `context` (Context) - Required - The application context. * `loginUser` (String) - Required - The customer service account. * `loginPwd` (String) - Required - The login password. * `block` (SobotResultBlock) - Optional - Callback result. * **Start with Token:** * **Description:** Starts the telemarketing system and enters the homepage using the company token. * **Method:** `SobotTMApi.startWithToken(Context context, String loginUser, String companyToken, SobotResultBlock block)` * **Parameters:** * `context` (Context) - Required - The application context. * `loginUser` (String) - Required - The customer service account. * `companyToken` (String) - Required - The company token. * `block` (SobotResultBlock) - Optional - Callback result. * **Start with Appkey and Appid:** * **Description:** Starts the telemarketing system and enters the homepage using appkey and appid. * **Method:** `SobotTMApi.startWithAppkey(Context context, String loginUser, String appKey, String appId, SobotResultBlock block)` * **Parameters:** * `context` (Context) - Required - The application context. * `loginUser` (String) - Required - The customer service account. * `appKey` (String) - Required - The login appKey (obtain from after-sales support). * `appId` (String) - Required - The login appId (obtain from after-sales support). * `block` (SobotResultBlock) - Optional - Callback result. ### Method 2: Fragment Embedding For special requirements, the SDK provides an integration method for the conversation interface using Fragment embedding, allowing for more flexible SDK usage. Login must be completed before redirection. * **Example Code:** ```java SobotTMFragment sobotTMFragment = (SobotTMFragment) getSupportFragmentManager() .findFragmentById(getResId("sobot_call_contentFrame")); if (sobotTMFragment == null) { sobotTMFragment = SobotTMFragment.newInstance(SobotTMConstant.STARTUP_MODE_ACTIVITY); addFragmentToActivity(getSupportFragmentManager(), sobotTMFragment, getResId("sobot_call_contentFrame")); } public void addFragmentToActivity(FragmentManager fragmentManager, Fragment fragment, int frameId) { FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.replace(frameId, fragment); transaction.commit(); } ``` ``` -------------------------------- ### Start Order Homepage - Method 1 Source: https://developer.zhichi.com/pages/f94c16 Launches the order SDK homepage by automatically handling login and page redirection. ```APIDOC ## POST /websites/developer_zhichi/startOrderHomepageMethod1 ### Description Starts the SDK's order homepage by automatically logging in the user and redirecting to the appropriate page. ### Method POST ### Endpoint /websites/developer_zhichi/startOrderHomepageMethod1 ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **account** (NSString) - Required - Customer service account. - **loginPwd** (NSString) - Required - Customer service account password. - **vc** (UIViewController) - Required - The view controller to perform the jump. - **resultBlock** (SobotResultBlock) - Optional - Callback for the execution result (code=1 indicates success). ### Request Example ```json { "account": "customer_account", "loginPwd": "customer_password", "vc": "current_view_controller", "resultBlock": "callback_block" } ``` ### Response #### Success Response (200) - **code** (NSInteger) - Indicates the result of the operation (1 for success). - **obj** (id) - Additional data returned by the callback. - **msg** (NSString) - A message describing the result of the operation. #### Response Example ```json { "code": 1, "obj": null, "msg": "Operation successful" } ``` ``` -------------------------------- ### Call Schedule Object Example (JSON) Source: https://developer.zhichi.com/pages/a7053e Example of the JSON object structure for defining a call schedule within a call task. Specifies the start and end times for making calls. ```json [ { "begin":"09:00", "end":"20:00" } ] ``` -------------------------------- ### Get Task Type List (GET) Source: https://developer.zhichi.com/pages/a9c8dc Retrieves a list of task types, optionally filtered by task type ID, update start time, and update end time. Uses query parameters for filtering. ```url https://www.soboten.com/zk-marketing-open/api/task/sop/v1/get_task_type_list?startTime=1667199225&endTime=1667203218 ``` -------------------------------- ### Initialize Agent Source: https://developer.zhichi.com/pages/0a0e4d The third step is to initialize the agent with necessary credentials and configurations. ```APIDOC ## Initialize Agent ### Description Initializes the agent with authentication token, company ID, agent details, and callback functions for success and error events. ### Method `agent.initAgent(options)` ### Endpoint N/A ### Parameters #### Request Body * **token** (string) - Required - Authentication token for agent login. Refer to the Sobot API authentication documentation for details on obtaining agent-level tokens. * **companyId** (string) - Required - The unique identifier for the company. * **agent** (string) - Required - The agent's employee ID or agent ID. * **agentType** (string) - Optional - Specifies the type of agent identifier. `0` for employee ID, `1` for agent ID. Defaults to employee ID if empty. * **allowStorageListen** (boolean) - Optional - Enables or disables multi-tab outbound calling. `false` disables it, `true` enables it. Defaults to disabled if empty. * **success** (function) - Optional - Callback function executed upon successful initialization. Receives a `msg` object with a `status: 'success'` property. * **error** (function) - Optional - Callback function executed if initialization fails. Receives a `msg` object with a `status: 'error'` property. ### Request Example ```javascript agent.initAgent({ token: 'xxxxxxxxxxxx', companyId: 'xxxxxxxxxxxxxx', agent: "1005", agentType: "0", allowStorageListen: true, success: function (msg) { console.log('new Client success : ', msg); }, error: function (msg) { console.log('new Client error : ', msg); } }); ``` ### Response #### Success Response * **status** (string) - Indicates the request status. `success` on successful initialization. #### Error Response * **status** (string) - Indicates the request status. `error` if initialization fails. ``` -------------------------------- ### Initialization API Source: https://developer.zhichi.com/pages/6d874b Initializes the SDK and sets the domain. ```APIDOC #### ● Initialization Initializes the SDK and sets the domain. > Example: ```java SobotTMOpenApi.initWithConfig(Application application, SobotTMConfigEntity config, SobotResultBlock block); ``` ### Parameters | Field | Name | Type | Nullable | Description | |---|---|---|---|---| | application | Context | Application | No | | | config | Initialization Parameters | SobotTMConfigEntity | No | | | block | Callback Function | SobotResultBlock | Yes | Callback function for interface invocation. | **SobotTMConfigEntity Details:** | Field | Name | Type | Nullable | |---|---|---|---| | openApiHost | General Interface Service Address | String | No | | callApiHost | Telemarketing Interface Service Address | String | No | | stompSocketUri | Agent Signaling Service | String | No | | janusSocketUri | Janus Message Listening Service | String | No | | sipProxy | Janus Proxy Service | String | No | ### Return Value Callback function details can be found in `SobotResultBlock`. ``` -------------------------------- ### Get Skill Group Metrics API Request Source: https://developer.zhichi.com/pages/19c6e0 This snippet shows how to make a GET request to the soboten OpenAPI to retrieve skill group metrics. It includes example headers and query parameters for specifying queue IDs, pagination, and sorting. ```HTTP GET https://openapi.soboten.com/callservice/v6/webmsg/monitoring/queues-metrics?queueIds={queueId}&pageNum={pageNum}&pageSize={pageSize}&sort={sort} Headers: Authorization: Bearer YOUR_ACCESS_TOKEN Idempotency-Key: YOUR_UUID Query Parameters: queueIds: 1001,1002 (Required) hideNumber: 1 (Required, 0: plain text, 1: masked, 2: plain text) pageNum: 1 (Required) pageSize: 15 (Required) sort: queueName,asc (Required) operatorUserId: (Optional, required for company-level tokens) ``` -------------------------------- ### Initialize Agent Instance Source: https://developer.zhichi.com/pages/0a0e4d The first step to using the JavaScript SDK is to create an agent instance. ```APIDOC ## Initialize Agent Instance ### Description Creates a new instance of the SobotClient agent. ### Method `new` ### Endpoint N/A ### Parameters None ### Request Example ```javascript const agent = new SobotClient.agent() ``` ### Response N/A ``` -------------------------------- ### Get Merchant Chat List API Request Example Source: https://developer.zhichi.com/pages/3831c1 This snippet shows an example of a POST request to the Merchant Chat List API. It includes the endpoint and the required JSON payload with parameters like union_code, partnerId, ts, and token. ```http POST /chat-third/tenant/5/user/chatIndexPage HTTP/1.1 Host: www.sobot.com Content-Type: application/json { "union_code": "your_union_code", "partnerId": "your_partner_id", "ts": 1607338626737, "token": "your_generated_token" } ``` -------------------------------- ### SDK文件说明 Source: https://developer.zhichi.com/pages/94e45d 本SDK包含SobotPush.framework、SobotDemo以及相关的说明文档。SobotPush.framework是智齿推送的核心接口代码库,SobotPushApi.h文件提供了接入功能。 ```APIDOC ## SDK文件说明 ### 描述 SDK包含SobotPush.framework、SobotDemo、和Doc相关说明文档。 | 文件名 | 说明 | 备注 | |------------------|------------------|--------| | SobotPush.framework | 智齿推送接口代码库 | 非必须 | | SobotPushApi.h | 该文件提供接入功能 | 非必须 | ``` -------------------------------- ### Get Customer Service Agent Info Response (No Data) Source: https://developer.zhichi.com/pages/a9c8dc Example response when no customer service agent data is found matching the query criteria. The 'items' array will be empty. ```json { "items": [], "page_no": 1, "page_count": 0, "total_count": 0, "page_size": 15, "ret_code": "000000", "ret_msg": "操作成功" } ``` -------------------------------- ### Get Customer Service Agent Info Response (Success) Source: https://developer.zhichi.com/pages/a9c8dc Example response for successfully retrieving customer service agent information, including agent details and pagination metadata. ```json { "items": [ { "qywx_third_userid": "wor8AYBgAAmOa0LQw8w9mYPr1Q-5lQRg", "qywx_build_userid": "ShangShanRuoShui", "serviceid": "ShangShanRuoShui", "service_qywx_name": "江海华" } ], "page_no": 1, "page_size": 15, "ret_code": "000000", "ret_msg": "操作成功" } ``` -------------------------------- ### Start Order System - Account, AppKey, AppId Login Source: https://developer.zhichi.com/pages/c3506b Initiates the order system using account, AppKey, and AppId for authentication and navigation to the home page. ```APIDOC ## SobotOrderApi.startWithAppkey ### Description Starts the order system using account, AppKey, and AppId, then navigating to the home page. ### Method (Implied through Java method call, typically a static method) ### Endpoint N/A (This is a client-side SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java SobotOrderApi.startWithAppkey(context, "customer_service_account", "app_key", "app_id", resultBlock); ``` ### Response #### Success Response (The SDK method handles navigation and callbacks) #### Response Example N/A ``` -------------------------------- ### Start Order System - Account Login Source: https://developer.zhichi.com/pages/c3506b Initiates the order system by logging in with account credentials and navigating to the home page. ```APIDOC ## SobotOrderApi.startWithAcount ### Description Starts the order system by logging in with email and password, then navigating to the home page. ### Method (Implied through Java method call, typically a static method) ### Endpoint N/A (This is a client-side SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java SobotOrderApi.startWithAcount(context, "customer_service_account", "password", resultBlock); ``` ### Response #### Success Response (The SDK method handles navigation and callbacks) #### Response Example N/A ``` -------------------------------- ### Get All Sub-Merchant AppKey Information Response (JSON) Source: https://developer.zhichi.com/pages/3831c1 Example response for fetching sub-merchant app key information. The 'data' field is an array of objects, each containing 'appId', 'appKey', 'companyId', and 'companyName'. ```JSON { "10004": { "data": [ { "appId": "3cb9c7b8dd914621ae3db8bef000d0", "appKey": "d14N6QO9e3p6", "companyId": "be7f05de11a54390c3f3ec35e6010b", "companyName": "测试二号" }, { "appId": "b17989cdf9b2428db63b90672b756015", "appKey": "wJH5gW65e98x", "companyId": "32d5fedaf268441dbde6d3eb23a17cee", "companyName": "测试三号" }, { "appId": "f6bbd4bce5924fde807dbd7ccc17af53", "appKey": "u11zt3o3Q09s", "companyId": "6f77727bdb074a128fc43d8788ee5a09", "companyName": "测试一号" }, ], "time": "2020-04-01 10:39:21" }, "retCode": "000000", "retMsg": "操作成功" } ``` -------------------------------- ### Get Customer Service Response Time Statistics Response (JSON) Source: https://developer.zhichi.com/pages/3831c1 Example response for the customer service response time statistics query. Includes 'filePath', 'unionCode', 'createTime', 'resultDate', and 'taskType'. ```JSON { "item": { "filePath":"https://sobot-test.oss-cn-beijing.aliyuncs.com/expo105-zip", "unionCode":"10004", "reateTime": "1573027669037", "resultDate": "2020-01-05", "taskType": "8" }, "ret_code": "000000", "ret_msg": "成功" } ``` -------------------------------- ### Get Q&A Quality Line Chart Data (Curl Example) Source: https://developer.zhichi.com/pages/z91mkr This example shows how to use cURL to call the Q&A Quality Overview API. It highlights setting the request method to POST, specifying the URL, and including essential headers such as 'token', 'language', 'timezoneid', and 'Content-Type'. The request body is sent as JSON data, containing the parameters for filtering and data retrieval. ```bash curl --location '/chat-static-api/api/robot/qAQuality/getLineChart' \ --header 'token: 21634d39bc674656a35fc4814746d90c' \ --header 'language: zh' \ --header 'timezoneid: Asia/Shanghai' \ --header 'Content-Type: application/json' \ --data '{ "robot_ids": [ 1 ], "start_time": "2023-06-14 00:00", "end_time": "2023-06-15 23:59", "source_ids": [ "0", "2" ], "channel_flags": [ "0_1" ], "show_fields":["msgVisitorToRobot","resolutionAndSatisfaction"], "show_flag":"num", "chart_type":"trend" }' ``` -------------------------------- ### Initialize SobotClient Agent with Options Source: https://developer.zhichi.com/pages/0a0e4d Initializes the SobotClient agent with necessary configuration parameters such as token, company ID, agent number, and callbacks for success and error handling. It also allows configuring features like multi-tab calling. ```javascript agent.initAgent({ token: 'xxxxxxxxxxxx', companyId: 'xxxxxxxxxxxxxx', agent: "1005", agentType: "0", allowStorageListen: true, success: function (msg){ console.log('new Client success : ', msg) }, error: function (msg){ console.log('new Client error : ', msg) } }) // 初始化成功会在success回调函数中返回msg,msg中status为success 参数见下表1 ``` -------------------------------- ### Start Ticket System with Account and Password Source: https://developer.zhichi.com/pages/c3506b Initiates the ticket system homepage by logging in with account and password. Requires Context, loginUser, loginPwd, and an optional callback. ```java /** * 通过邮箱密码方式启动工单系统,进入首页 * @param context * @param loginUser 客服账号 * @param loginPwd 登录密码 * @param block 回调结果 可为空 */ SobotOrderApi.startWithAcount(Context context, String loginUser, String loginPwd, SobotResultBlock block); ``` -------------------------------- ### Fetch Regional Field Information (cURL) Source: https://developer.zhichi.com/pages/950d89 This example demonstrates how to use cURL to call the Sobot API and retrieve regional field information. It requires a valid token for authentication and specifies the GET request method. ```bash curl -H 'token:4ac37cb2e9c740dba4b75a34d5358802' https://www.sobot.com/api/ws/5/ticket/get_region ``` -------------------------------- ### 初始化 SDK Source: https://developer.zhichi.com/pages/f94c16 在启动智齿工单 SDK 之前,必须调用 `initWithHost` 方法进行初始化配置。此方法会设置基础配置、UI 配置并提供回调。 ```APIDOC ## 初始化 SDK ### 描述 初始化智齿工单 SDK,设置必要的配置参数,以便 SDK 正常运行。 ### 方法 ```objectivec + (void)initWithHost:(NSString *)host config:(SobotCacheEntity *)config kitInfo:(SobotKitConfig *)kitInfo result:(SobotResultBlock)resultBlock; ``` ### 参数 | 参数 | 类型 | 必填 | 描述 | |---|---|---|---| | host | NSString | 否 | 访问域名,默认为阿里云域名 | | config | NSObject | 是 | 软件基础配置类 `SobotCacheEntity` | | kitInfo | NSObject | 是 | UI 相关配置类 `SobotKitConfig` | | resultBlock | Block | 否 | 初始化状态回调,`code=1` 表示成功 | ### 示例代码 ```objectivec SobotCacheEntity *config = [[SobotCacheEntity alloc] init]; config.bundleName = @"SobotOrder"; config.languageTableName = @"SobotLocal"; config.languagePathInBundle = @"Localizable"; config.colorTableName = @"SobotColor"; config.absoluetelanguage = @"zh-Hans"; [SobotOrderApi initWithHost:@"" config:config kitInfo:kitInfo result:^(NSInteger code, id _Nullable obj, NSString *_Nullable msg) { }]; ``` ``` -------------------------------- ### Query Agent Phone Type Example (JavaScript) Source: https://developer.zhichi.com/pages/2ccbcf Illustrates the usage of the `agent.queryPhoneType` function to get information about an agent's available phone types and their default setting. Includes success and error callbacks. ```javascript agent.queryPhoneType({ success: function(event) { // do something ... }, error: function(cause) { // Error, can't go on... }, }) ``` -------------------------------- ### Get Robot Answer Type Distribution (curl) Source: https://developer.zhichi.com/pages/z91mkr This snippet demonstrates how to call the API endpoint to retrieve the distribution of robot answer types using curl. It includes the necessary headers and a JSON payload with example parameters. ```curl curl --location '/chat-static-api/api/robot/qAQuality/getRobotAnswerTypeResp' \ --header 'token: 63cb0a4f1e5b4678b17504e876b8673a' \ --header 'language: zh' \ --header 'timezoneid: Asia/Shanghai' \ --header 'Content-Type: application/json' \ --data '{ "robot_ids": [ 1 ], "start_time": "2023-07-30 00:00", "end_time": "2023-08-28 23:59", "source_ids": [ "0", "2" ], "channel_flags": [ "0_1" ] }' ``` -------------------------------- ### 手动集成SDK Source: https://developer.zhichi.com/pages/94e45d 开发者可以通过下载SDK包,将SobotPush.framework和友盟推送SDK集成包添加到Xcode工程中。此外,还需要链接系统框架以支持推送功能。 ```APIDOC ## 手动集成SDK ### 描述 下载SDK包,将SobotPush.framework和友盟推送SDK集成包添加到你的工程里。智齿推送SDK基于友盟SDK的实现,需要添加依赖系统框架。 ### 集成步骤 1. 下载SDK:iOS_Push_SDK 2. 解压SDK,并将`SobotPush.framework`和友盟推送SDK集成包添加到工程。 3. 在工程TARGETS -> BuiLd Phases -> Link Binary With Libraries 中添加以下依赖项: - CoreAudio.framework - libz.tbd - SystemConfiguration.framework - libsqlite3.tbd - UserNotifications.framework - CoreTelephony.framework ``` -------------------------------- ### Delete Message Template Request Example (cURL) Source: https://developer.zhichi.com/pages/720725 This code snippet demonstrates how to send a GET request to delete a message template. It includes the API endpoint and necessary headers for authentication and specifying the template to be deleted. ```shell curl https://sg.sobot.com/chat-whatsapp/template/deleteTemplate?wabaId=12345&templateName=test -H 'token: 4ac37cb2e9c740dba4b75a34d5358802' ``` -------------------------------- ### Query Tickets by Update Time API Request Source: https://developer.zhichi.com/pages/950d89 This snippet demonstrates how to make a GET request to the Sobot API to retrieve tickets updated within a specific time frame. It includes essential query parameters like update start and end datetimes. ```curl curl -H "token:4ac37cb2e9c740dba4b75a34d5358802" https://www.sobot.com/api/ws/5/ticket/query_tickets_by_update_time? update_start_datetime=2018-09-18 00:00:00&update_end_datetime=2018-09-18 23:59:59 ``` -------------------------------- ### Start Ticket System with App Key and ID Source: https://developer.zhichi.com/pages/c3506b Initiates the ticket system homepage using account, appKey, and appId. Requires Context, loginUser, appKey, appId, and an optional callback. ```java /** * 通过账号+appKey+appId启动工单系统 * * @param context * @param loginUser 客服账号 * @param appKey 登录appKey 找售后同事获取(客户账号开通时会有这个) * @param appId 登录appId 找售后同事获取(客户账号开通时会有这个) * @param block */ SobotOrderApi.startWithAppkey(Context context, String loginUser, String appKey, String appId, SobotResultBlock block); ``` -------------------------------- ### Example cURL Request for Reception Overview Trend Source: https://developer.zhichi.com/pages/z91mkr This snippet demonstrates how to make a request to the Get Reception Overview Trend API using cURL. It includes setting the appropriate headers like token, language, timezone, and content type, along with the JSON data payload. ```bash curl --location '/chat-static-api/api/robot/receptionOverview/getReceptionOverviewTrend' \ --header 'token: 1e50ef3b9b974b62bbfc686cfd237904' \ --header 'language: zh' \ --header 'timezoneid: Asia/Shanghai' \ --header 'Content-Type: application/json' \ --data '{ "robot_ids": "1", "sources": "", "channel_flags": "", "start_date": "2023-07-24", "end_date": "2023-07-25" }' ``` -------------------------------- ### Android SDK 依赖配置 Source: https://developer.zhichi.com/pages/66bfb6 在 Android 项目的 app build.gradle 文件中添加 sobot_push 模块依赖,以集成智齿科技的推送SDK。完成依赖配置后,需要进行项目清理以使更改生效。 ```gradle dependencies { implementation project(':sobot_push') } ``` -------------------------------- ### Query Districts/Counties by City ID (curl) Source: https://developer.zhichi.com/pages/90edcd This curl command demonstrates how to query district and county information by city ID using the Sobot API. It specifies the GET request method, content type, and includes an authorization token. The example uses a city ID of '130300'. ```shell curl https://www.sobot.com/api/scrm/5/user_dynamic/area/130300 -X GET -H 'content-type: application/json' -H 'token: 4ac37cb2e9c740dba4b75a34d5358802' \ ``` -------------------------------- ### Agent Ready Callback Example (JavaScript) Source: https://developer.zhichi.com/pages/2ccbcf Demonstrates how to use the `agent.ready` function, which includes success and error callback handlers. This function is used to set the agent's status to ready. ```javascript agent.ready({ success: function(event) { // do something ... }, error: function(cause) { // Error, can't go on... }, }) ```