Home  >  Article  >  WeChat Applet  >  WeChat public platform development customer service interface to send customer service messages

WeChat public platform development customer service interface to send customer service messages

高洛峰
高洛峰Original
2017-02-24 17:17:034928browse

When the user actively sends a message to the official account (including sending information, clicking the custom menu clike event, subscribing event, scanning QR code event, payment success event, user rights protection), WeChat will push the message data to Developers, developers can call the customer service message interface within a period of time (currently 24 hours) and send messages to ordinary users by POSTing a JSON data packet. There is no limit on the number of sending times within 24 hours. This interface is mainly used for functions such as customer service that require manual message processing, so that developers can provide users with better services.

1. Get ACCESS_TOKEN

http request method: GET
https://api.weixin.qq.com/cgi- bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET

Parameter Is it required Description
grant_type Yes Get access_token fill in client_credential
appid Yes Third party User's unique credential
secret is 's third-party user's unique credential key, which is appsecret

Under normal circumstances, WeChat will return the following JSON data packet to the public account:
{"access_token":"ACCESS_TOKEN","expires_in":7200}

2. Send a message

Send a text message

微信公众平台开发 客服接口发送客服消息

微信公众平台开发 客服接口发送客服消息

Send a picture (media_id needs to be uploaded first Picture obtained)

$img = '{
    "touser":"oLVPpjqs9BhvzwPj5A-vTYAX3GLc",
    "msgtype":"image",
    "image":
    {
      "media_id":"jViS8sQUXIh6rTdkz2qUOD5pvChYpp50i9rsLR4YnCm-pqdpiHhz6xbN2KAboScV"
    }
}';

微信公众平台开发 客服接口发送客服消息

The following is a screenshot of the customer service system developed using the customer interface

微信公众平台开发 客服接口发送客服消息

微信公众平台开发 客服接口发送客服消息微信公众平台开发 客服接口发送客服消息


####################################################################### net! ###
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn