Objective
Unconsciously already 14 articles, actually already had nothing to write. But suddenly found Layim in the customer service function is not used. So, take some time to finish it. In fact, the previous work has completed the customer service function more than half, the rest of us a little adjustment can be. Today's demo we put behind, directly into the explanation.
Customer Service Ideas Explained
We go to some company website will find that the side of the page or automatically pop up some customer service chat box, people are very enthusiastic to talk with you. We can also use Layim to achieve. First, the page to add a button, click the button to trigger customer service mode.
<a onclick="javascript:global.other.kefu (14896)"> I am customer service </a>
We first login to a user, simulate customer service personnel. (A normal user login, his ID is 14896, corresponding to the above code of 14896, of course, this ID as long as the set as a customer service ID.) Not a dead value)
Then we change a browser (in order not to make the cookie conflict cause oneself and own dialogue), change a user to log in, the simulation consultant. After logging in, click the I am customer service button to pop up the customer service interface and send messages such as:
// Open Customer Service kefu:function (kfid) { layim.chat ({ ' online customer service-freesia ' ) ' Kefu ' '/headphotos/default.jpg ', Id:kfid});}
In this explanation, why here to send a message to the customer service, the opposite received it, in fact, this. First, when we click Send to trigger the customer service send event. There are three kinds of layim in the default, Friend,group,kefu. In fact, friend and Kefu can be classified as a class, they are equivalent to 1 pairs of chat, so we are so, directly call 1 to 1 Chat send method can be. Only the message type that you received on the opposite side is kefu.
Here our customer service how to deal with it, in fact very simple, do not move, directly like 1v1 chat as well, because Layim in the GetMessage method inside has judged the difference between Kefu and friend. So, we just wait for the message quietly.
Layim.getmessage (RESULT.MSG); // because the RESULT.MSG is compliant with the Layim interface specification, it is brought directly into
Then, for example, our customer service mm received a message.
Open the Message interface, customer service mm reply customer. Similarly, the customer received a reply message. (In fact, the customer service message is 1 to 1 messages, but the UI side of the processing is different)
Such a complete customer service consultation process is over, if you want to do a perfect point can also do a customer service satisfaction evaluation and other functions.
Summarize
The realization of customer service message is not very simple, of course ... Not simple, this article is simple because the previous 1 to 1 chat we have done a lot of back-end code work and front-end processing, so, to pick up the message when you will find a pattern to apply, can be used directly. Finally, the same likes to study Layim classmate said, Layim is the code of the great God, but does not mean that you can not move him, read more source code, you will find the design of the clever place and learn to master the code and design ideas. Then you divert the function you want to add, it is not a piece of cake!
This series of blog tutorials: ASP. NET SignalR with LayIM2.0 easy to implement the Web chat room Combat series (constantly updated)
ASP. NET SignalR with LayIM2.0 easy to implement the missing customer service message in the web chat room (14)