Home >WeChat Applet >WeChat Development >WeChat public account development WeChat message type analysis
In this article, let’s learn about the message type analysis of WeChat public account development
When an ordinary WeChat user sends a message to the public account, the WeChat server will POST the XML data packet of the message to the URL filled in by the developer. . The push XML data packet structure of each message type is as follows.
##Table of Contents[Hide]
|
<xml> <ToUserName><![CDATA[toUser]]></ToUserName> <FromUserName><![CDATA[fromUser]]></FromUserName> <CreateTime>1348831860</CreateTime> <MsgType><![CDATA[text]]></MsgType> <Content><![CDATA[this is a test]]></Content> <MsgId>1234567890123456</MsgId> </xml>
ToUserName | |
---|---|
WeChat ID | FromUserName |
CreateTime | |
MsgType | |
Content | |
MsgId | |
Use web debugging tool to debug this interface |
Picture message
<xml> <ToUserName><![CDATA[toUser]]></ToUserName> <FromUserName><![CDATA[fromUser]]></FromUserName> <CreateTime>1348831860</CreateTime> <MsgType><![CDATA[image]]></MsgType> <PicUrl><![CDATA[this is a url]]></PicUrl> <MediaId><![CDATA[media_id]]></MediaId> <MsgId>1234567890123456</MsgId> </xml>
ToUserName | |
---|---|
WeChat ID | FromUserName |
CreateTime | |
MsgType | |
PicUrl | |
MediaId | |
MsgId | |
Use web debugging tool to debug this interface |
Voice message
<xml> <ToUserName><![CDATA[toUser]]></ToUserName> <FromUserName><![CDATA[fromUser]]></FromUserName> <CreateTime>1357290913</CreateTime> <MsgType><![CDATA[voice]]></MsgType> <MediaId><![CDATA[media_id]]></MediaId> <Format><![CDATA[Format]]></Format> <MsgId>1234567890123456</MsgId> </xml>
ToUserName | |
---|---|
WeChat ID | FromUserName |
CreateTime | |
MsgType | |
MediaId | |
Format | |
MsgID | |
Use web debugging tools to debug this interface |
Video message
<xml> <ToUserName><![CDATA[toUser]]></ToUserName> <FromUserName><![CDATA[fromUser]]></FromUserName> <CreateTime>1357290913</CreateTime> <MsgType><![CDATA[video]]></MsgType> <MediaId><![CDATA[media_id]]></MediaId> <ThumbMediaId><![CDATA[thumb_media_id]]></ThumbMediaId> <MsgId>1234567890123456</MsgId> </xml>
ToUserName | |
---|---|
微信 | FromUserName |
CreateTime | |
MsgType | |
MediaId | |
ThumbMediaId | |
MsgId | |
Use web debugging tool to debug this interface |
Geolocation message
<xml> <ToUserName><![CDATA[toUser]]></ToUserName> <FromUserName><![CDATA[fromUser]]></FromUserName> <CreateTime>1351776360</CreateTime> <MsgType><![CDATA[location]]></MsgType> <Location_X>23.134521</Location_X> <Location_Y>113.358803</Location_Y> <Scale>20</Scale> <Label><![CDATA[位置信息]]></Label> <MsgId>1234567890123456</MsgId> </xml>
ToUserName | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
WeChat ID | FromUserName | |||||||||||||||||
CreateTime | ||||||||||||||||||
##MsgType | location | |||||||||||||||||
Location_X | Geolocation dimension | |||||||||||||||||
Location_Y | Geolocation accuracy | |||||||||||||||||
Scale | Map zoom size | |||||||||||||||||
Label | Geolocation information | |||||||||||||||||
MsgId | Message id, 64-bit integer type | |||||||||||||||||
参数 | 描述 |
---|---|
ToUserName | 接收方微信号 |
FromUserName | 发送方微信号,若为普通用户,则是一个OpenID |
CreateTime | 消息创建时间 |
MsgType | 消息类型,link |
Title | 消息标题 |
Description | 消息描述 |
Url | 消息链接 |
MsgId | 消息id,64位整型 |
使用网页调试工具调试该接口
The above is the detailed content of WeChat public account development WeChat message type analysis. For more information, please follow other related articles on the PHP Chinese website!