Get the App
SLTechnology News&Howtos  ›  Development  › 

How does php realize Multi-customer Service system in Wechat Public platform Development Model

Shulou Source: shulou.com Published: 2022-06-03 14:57:18 10月24日 Update

This article mainly explains "how php realizes multi-customer service system in the development mode of Wechat public platform". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how php implements multi-customer service system in Wechat public platform development model".

1. Reply to multiple customer service messages

In the new Wechat agreement, the development mode can also be connected to the customer service system. If a developer needs to let a user use the customer service system, he needs to return a message with a MsgType of transfer_customer_service when he receives the message sent by the user. When receiving this message, the Wechat server will forward the message sent by the user this time and within a period of time to the customer service system.

Examples of messages returned are as follows

1399197672

The implementation of this message is as follows (based on the Wechat public platform PHP SDK of Fangbi Studio)

/ reply to multi-customer service message private function transmitService ($object) {$xmlTpl = "% s"; $result = sprintf ($xmlTpl, $object- > FromUserName, $object- > ToUserName, time ()); return $result;}

Second, trigger multi-customer service conversation

In general, when users want to ask questions, they often ask questions like "Hello" and "Hello".

We use these words as trigger keywords, and when the text message sent by the user contains these words, a multi-customer service message is returned to the user (the user does not feel any content on Wechat. However, the Wechat public account will forward the user's messages to customer service this and for some time to come).

The implementation code is as follows:

/ / receive text message private function receiveText ($object) {$keyword = trim ($object- > Content); if (strstr ($keyword, "complaint") | | strstr ($keyword, "Hello") | | strstr ($keyword, "Hello") {$result = $this- > transmitService ($object);} return $result;}

III. Complete code

This code has been tested and returns multiple customer service messages in the custom menu, which cannot allow users to enter the multi-customer service status. after using multiple customer service messages, all subsequent messages will be forwarded as customer service messages within a period of time. The automatic reply in the original development mode will be invalidated.

Thank you for reading, the above is "how php in the Wechat public platform development model to achieve multi-customer service system" content, after the study of this article, I believe you have a deeper understanding of how php in the Wechat public platform development model to achieve multi-customer service system this problem, the specific use still needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Message multi-guest user mode system development public platform content time code hello text question learning studio situation work express test Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple MariaDB OPPO Reno Huawei Docker