Starting Online Help
Diyalog Platform provides live assistance service to your customers through your mobile application with messaging.
You can download full simple online help android project from SimpleOnlineHelp link.
First of all, you need to know the flow about online help in Diyalog platform.
The flow is like below :
You should first create and get a transaction hash data in Diyalog server by calling Diyalog server's rest api from your application server. Diyalog server will create a transactionHash and then you could start an online help by using this transaction hash. This step is important for security.
- Your mobile app should call your application server to get transactionHash with the customer and device hash.
- Your application server should create and get transactionHash in Diyalog Server by calling gettransactionhashforonlinehelp rest api. Only server with valid credentials can call this api in Diyalog server and generate transactionHash. You can get the credential information for your server from the Diyalog admin.
- Diyalog server creates and return transactionHash to your server.
- Your app server return transactionHash to your mobile app.
- After getting transactionHash from the server, your mobile app can call startAnonymousOnlineHelp method in the DiyalogSDK with it.
- DiyalogSDK call Diyalog server and initiate online help and then waits until other party (agent) to connect.
- Diyalog server create online help and then return OK to mobile app. If there is an error, server will return error to mobile app.
- DiyalodSDK will return response of startAnonymousOnlineHelp method to your app. Then you can show wait screen in your app if you manage wait screen. If not, DiyalogSDK will show default wait screen.
- When this process starts, a request should have been sent to the call system queue for online help from your own system. When an agent (representative) open a customer from the queue, he initiates the online help chat with the customer through the Diyalog application.
- Diyalog server starts online help with each parties who are agent and customer.
- After online help startted with customer and agent. Diyalog SDK will send online help state to your app via callback function that you subcscribe. These states can be "STARTED", "CHAT_INPROGRESS", "CHAT_ENDED" and "N0_CHAT"
- DiyalogSDK will update your app by all changings in the online help states.
An online help can be started at the relevant stage of your application as follows. When you call the following method, Diyalog first performs the necessary security checks for the relevant customer according to the transactionHash, deviceHash and customer number trio and starts the live help for the relevant customer.
Waiting screen should be shown to the customer until the live help is started by the customer representative. You can manage the waiting screen in your own application or use Diyalog SDK's waiting screen if you prefer.
Parameters |
---|
context (Activity) Activity that this method called from. |
customerId (String) Customer id number. |
customerName (String) Name of the customer. |
idNumber (Long) National ID number of the customer. It is not must. You can set 0 for it. |
customerPhone (Long) Opsiyoneldir. Phone number of the customer. This paramater is optional. It can be set null. |
email (Long) Optional Email address of the customer. This paramater is optional. It can be set null. |
helpType (OnlineHelpType) This parameter is used to define help type. It can be OnlineHelpType.CHAT, OnlineHelpType.VIDEO_CALL, OnlineHelpType.VOICE_CALL. |
transactionHash (String) It is the transactionHash value that you create in the Dialog server through your own application server. |
waitDisplayText (String) Optional It is the text information that will be displayed on the waiting screen. This parameter is used only if Diyalog SDK will manage waiting screen. |
isLoggedIn (boolean)It is the flag that show customer is logged in ot not into main app. |
isBackground (boolean)It is the flag that show waiting screen will be managed by Diyalog SDK ot not. |
onlineHelpStartResult (OnlineHelpStartResult) startAnonymousOnlineHelp method is an asynchronous method and sends the result (information that the online help has been started) to your application with this callback method. |
You can find the detail about VideoCallResult class
After getting success from startAnonymousOnlineHelp method, you can listen state of online help by subscribing the onlineHelpState. You can use following method for it.
Online help state is a string and can have following values.
"NO_CHAT" : Default and initial value. There is no active chat.
"STARTED" : Online help started and Diyalog wait screen is shwing. If you handle wait screen, this state will not return.
"CHAT_INPROGRESS" : Agent ve customer started to conversation.
"CHAT_ENDED" : Conversation completed.
You can see complete code sample that you need to implement below.
If startAnonymousOnlineHelp method return successfull and you showed wait screen to customer and the customer press cancel button in your wait screen before agent start online help, you should call closeMessaging method to stop process
Done :)
You can download full simple online help android project from SimpleOnlineHelp link.