In the history of the most detailed ring mobile customer service APP fast integration cheats

In the history of the most detailed ring mobile customer service APP fast integration cheats

The
project needs to integrate the ring letter customer service system, the two day of toil and customer communication after finishing an article for backup

Ring letter customer service really really really praise

Writing time: 2017.03.07 PM

Relevant documents:
ring letter development documentation
mobile service iOS SDK
iOS SDK API integrated mobile service
mobile service: Mall “demo source and EaseUI source (iOS)
Android SDK integrated
mobile service mobile service Android SDK API
mobile service: Mall” demo source and EaseUI source (Android)

Background:
mobile customer service background
ring management background

Detailed steps are as follows:

SDK aspects
  1. The first mobile service: Mall “demo source and EaseUI source (iOS) download the SDK IM SDK based on 3.x, using the IM function as the ring letter (non video), need to use this document to initialize, login, logout, do not need to add IM to the SDK, the IMSDK-API is often used.
  2. Open the downloaded good demo architecture, In the history of the most detailed ring mobile customer service APP fast integration cheats

    the two red folder inside the frame, copied to the appropriate path of their projects in Finder (where there was a pit, later afternoon details), and then drag to select the Create groups project.

  3. Build Phases —> Link Binary With Libraries AudioToolbox.framework AVFoundation.framework libc++.dylib libz.dylib add dependent libraries libstdc++.6.0.9.dylib libsqlite3.dylib / / Xcode version 7 and above. Dylib.Tbd
    In the history of the most detailed ring mobile customer service APP fast integration cheats
    as below:
  4. Build Settings —> Linking —> Other Linker Flags increase in -ObjC.
  5. SDK does not support bitcode, Build Settings —> Build Options —> Enable Bitcode set NO.
    In the history of the most detailed ring mobile customer service APP fast integration cheats
    step 4, step 5
  6. In the history of the most detailed ring mobile customer service APP fast integration cheats

    to increase privacy rights to related permissions in engineering info.plist file: Privacy – Photo Library Usage Description need access to your Privacy Usage Description album – Microphone Privacy – you need to access the microphone Camera Usage Description need access to your camera with the permission settings, please point me i.

  7. Add the following code in.Pch or #ifdef __OBJC__ global.H: #import “helpdesk_sdk.h” #import “HelpDeskUI.h” #endif if no.Pch, the following steps:
    A. + N command created PCH File —> Next —>
    In the history of the most detailed ring mobile customer service APP fast integration cheats

    B. —&gt Create
    can modify the name; In the history of the most detailed ring mobile customer service APP fast integration cheats

    C. configuration as shown below prefix
    In the history of the most detailed ring mobile customer service APP fast integration cheats
    , you can search

Create APP Association

The above steps can be easily completed according to the document, but the relevant APP Association, compared to the pit, and if there is no experience in the integration of the letter to the ring, then it is easy to code into errors, please follow the following steps:

  1. Need to apply for two accounts: mobile customer service background, ring letter management background, if you already have the next step.
  2. The application of
    In the history of the most detailed ring mobile customer service APP fast integration cheats
    to create
    click display application information in the letter management background (AppKey, Client ID, Client Secret the
    In the history of the most detailed ring mobile customer service APP fast integration cheats
    to remember)
  3. Register the IM user (name to remember) in the ring management background
    In the history of the most detailed ring mobile customer service APP fast integration cheats
  4. To create a ring letter management background APP Association (the official document, the official document describes some is not comprehensive, but is not comprehensive)
    in the back right corner selection manager mode —&gt channel management; —> mobile phone APP —> APP —&gt to add Association; Association of IM
    In the history of the most detailed ring mobile customer service APP fast integration cheats

    In the history of the most detailed ring mobile customer service APP fast integration cheats account number

  5. The application of input related information in the box below IM
    In the history of the most detailed ring mobile customer service APP fast integration cheats

    user input for the associated application created is completed, can be kept below
    In the history of the most detailed ring mobile customer service APP fast integration cheats

  6. Note the tenantId tenant ID, below: set —> enterprise information
    In the history of the most detailed ring mobile customer service APP fast integration cheats
  7. The above steps are completed, the official document is not mentioned in step: set —>
    In the history of the most detailed ring mobile customer service APP fast integration cheats

    session allocation rules so APP Association end can cut back to the customer service mode

Code section
  1. DidFinishLaunchingWithOptions entrance class, initialize the ring letter customer service HOptions *option [[HOptions alloc] = init]; option.appkey = @ option.tenantId @ = “* * *”; “* * *” mentioned above; / / set —> / / enterprise information push certificate name #if DEBUG @ option.apnsCertName = “development environment push certificate name”; #else option.apnsCertName = @ “official environmental push certificate name”; #endif //Kefu SDK initialization, initialize after the failure will not be able to use SDK HError *initError = [[HChatClient sharedClient] initializeSDKWithOptions:option]; if (initError) {/ / UIAlertView *alertView = [[UIAlertView alloc] initialization error initWithTitle:@ “” message:@ “customer service system initialization error” delegate:nil cancelButtonTitle:@ “knew” otherButtonTitles:nil, nil]; [alertView Show];} [[HChatClient addDelegate:self sharedClient] delegateQueue:nil];
  2. Entry class follows HChatClientDelegate
  3. Change of state entrance class implementation agreement / / ring letter to connect to the server when the customer will receive the callback, there are several situations, will cause the method call: 1 after a successful login, mobile phone can not access, will call the callback 2 after a successful login, the network state changes, will call the callback / / @param aConnectionState current state – (void) connectionStateDidChange: (HConnectionState) {aConnectionState NSLog (@ /n—–> aConnectionState = HConnectionConnected% @, @? “Connected”: @ “not connected”);}
  4. To achieve the following methods – (void) applicationWillEnterForeground: (UIApplication *) application sharedClient] {[[HChatClient applicationWillEnterForeground:self];} – (void) applicationDidEnterBackground: (UIApplication * application) {HChatClient sharedClient] applicationDidEnterBackground:self]} “;
  5. Rapid integration can be as follows:
    find the download of the demo are as follows.H and.M (pictured) copy to your project, and drag to the project:
    In the history of the most detailed ring mobile customer service APP fast integration cheats

    because HDChatViewController inherits from HDMessageViewController (in HelpDeskUI), can be directly applied to the relevant logic inside the demo, to modify the compiler due to the lack of relevant post reference file error, can be used as a chat page.

  6. The monitor into the chat page of the func, can carry out the following operations:
    registration verified here to register the account, IM will appear in the list of users of the application letter management background in HChatClient *client = [HChatClient sharedClient]; / / registerWithUsername: password: registered users, synchronization method, will block the current thread. Not recommended, recommended the background by REST fast registration, registered users / here is equivalent to using the app contact customer service users can create according to certain rules, the rules are as follows HError *error HChatClient sharedClient] registerWithUsername:@ “=” fengfengAppUser “password:@” 123456 “]; if (error & & error.code! = HErrorUserAlreadyExist) {/ / HErrorNetworkUnavailable / / HErrorUserAlreadyExist user network is not available saved In the authority of registration / / HErrorUserAuthenticationFailed open (admin interface set [open] | authorization) / / HErrorUserIllegalArgument (NSLog @ username illegal registration failure; error code:%d, error description, error.code, error.errorDescription:% @ “);} ring letter ID rules
    login: / / since the HChatClient has a isLoggedInBefore (BOOL), can be the first make a judgment if login before operation (client.isLoggedInBefore! = YES) {/ / this login account is above the registered account, or from the server to obtain account, that is using the app contact customer service user account HError *error2 =” fengfengAppUser [client loginWithUsername:@ “password:@” 123456 “]; if (! Error2) {a successful login here / / / / @” fengfeng01 “parameter is above In the background of the associated IM ring letter customer service account HDChatViewController *chatVC = [[HDChatViewController alloc] initWithConversationChatter:@ “fengfeng01”]; [weakSelf.navigationController pushViewController:chatVC animated:YES];} else {/ / login failed [weakSelf showTextHud:error.errorDescription]; return else;}} {/ / / / have successfully logged here @ “fengfeng01” parameter must be above in the ring channel customer service related background the IM *chatVC [[HDChatViewController alloc] initWithConversationChatter:@ account HDChatViewController = “fengfeng01”]; [weakSelf.navigationController pushViewController:chatVC animated:YES];} here is important, alone again listed here: / / @ “fengfeng01” parameter, a The above is in the loop channel customer service related IM background account, what is the associated account here, what HDChatViewController *chatVC parameter = [[HDChatViewController alloc] initWithConversationChatter:@ “fengfeng01”];
Message send complete callback block

When configured correctly, the sending message can see the following information in the callback
block as shown in figure.M:

In the history of the most detailed ring mobile customer service APP fast integration cheats

in HDMessageViewController.m, as follows: func breakpoint:

In the history of the most detailed ring mobile customer service APP fast integration cheats

The
console is as follows:

In the history of the most detailed ring mobile customer service APP fast integration cheats

key fields in the box:
_conversationId, _to: refers to the customer interface in the ring letter when the APP associated with the IM account.
_from: refers to the above registration or login account.
error: it is a good choice to view the information in the error when the chat is abnormal.

This letter: fully integrated customer service chat system, can receive the following information in the ring channel customer service background if all goes as follows:
ring letter customer service background administrator mode —> —>
session

In the history of the most detailed ring mobile customer service APP fast integration cheats

Problems encountered in the integration process: (the integration process meets new problems at any time)

  1. Repeat the import into the SDK compiler error: figure
    In the history of the most detailed ring mobile customer service APP fast integration cheats

    solution: due to customer service ring letter SDK integrates some commonly used third party libraries, if the project itself has these third party libraries, it will cause conflict, deleted, and then the error of the local modification of normal call can
    In the history of the most detailed ring mobile customer service APP fast integration cheats

  2. After the communication with customer service to some questions: Q: APP in the integration of the customer service system, the relationship between customer and customer service coordination? The
    A:IM service number is the IM user, you registered a IM user is then used to bind the IM service number, and then the bound IM service client login user chat sessions, customer service system will chat with the IM service to Q service: the equivalent of customer service and users before you
    hub M registered IM users: Q: it can be understood why this account can be registered on the server, you can also add manually in the backstage management system.
    M: is an interface operation, the server rest interface: Q is not returned by the server for landing IM account APP service user association are different?
    M: not necessarily, there is bound to an IM mobile customer service number will be enough, other IM user login client (server returned or registered) to the mobile service bound IM message service number, customer service system can receive the client to send messages over the ring letter

Irregular updates are not appropriate place, please point to thank