search
HomeWeChat AppletWeChat DevelopmentWeChat 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.

##Text message

##Table of Contents

[Hide]

  • 1 Text message

  • 2 Picture message

  • 3 Voice message

  • ##4

    Video message

  • 5

    Geolocation message

  • ##6
  • Link message

 <xml>
 <tousername></tousername>
 <fromusername></fromusername> 
 <createtime>1348831860</createtime>
 <msgtype></msgtype>
 <content></content>
 <msgid>1234567890123456</msgid>
 </xml>

ParameterDescriptionDeveloperSender account (an OpenID)Message creation time (integer)textText message contentMessage id, 64-bit integerUse web debugging tool to debug this interface
ToUserName
WeChat ID FromUserName
CreateTime
MsgType
Content
MsgId

Picture message

 <xml>
 <tousername></tousername>
 <fromusername></fromusername>
 <createtime>1348831860</createtime>
 <msgtype></msgtype>
 <picurl></picurl>
 <mediaid></mediaid>
 <msgid>1234567890123456</msgid>
 </xml>

ParametersDescriptionDeveloperSender account (an OpenID)Message creation time (integer)image Picture link Picture message media id, you can call the multimedia file download interface to pull the data. Message id, 64-bit integerUse web debugging tool to debug this interface
ToUserName
WeChat ID FromUserName
CreateTime
MsgType
PicUrl
MediaId
MsgId

Voice message

<xml>
<tousername></tousername>
<fromusername></fromusername>
<createtime>1357290913</createtime>
<msgtype></msgtype>
<mediaid></mediaid>
<format></format>
<msgid>1234567890123456</msgid>
</xml>

ParametersDescriptionDeveloperSender account (an OpenID)Message creation time (integer)Voice is voiceVoice message media id, you can call the multimedia file download interface to pull the data. Voice format, such as amr, speex, etc.Message id, 64 Bit integerUse web debugging tools to debug this interface
ToUserName
WeChat ID FromUserName
CreateTime
MsgType
MediaId
Format
MsgID

Video message

<xml>
<tousername></tousername>
<fromusername></fromusername>
<createtime>1357290913</createtime>
<msgtype></msgtype>
<mediaid></mediaid>
<thumbmediaid></thumbmediaid>
<msgid>1234567890123456</msgid>
</xml>

ParametersDescriptionDeveloperSender account (an OpenID) Message creation time (integer) Video is videoVideo message media id, you can call multimedia files The download interface pulls data. The media id of the video message thumbnail, you can call the multimedia file download interface to pull the data. Message id, 64-bit integerUse web debugging tool to debug this interface
ToUserName
微信 FromUserName
CreateTime
MsgType
MediaId
ThumbMediaId
MsgId

Geolocation message

<xml>
<tousername></tousername>
<fromusername></fromusername>
<createtime>1351776360</createtime>
<msgtype></msgtype>
<location_x>23.134521</location_x>
<location_y>113.358803</location_y>
<scale>20</scale>
<label></label>
<msgid>1234567890123456</msgid>
</xml>

ParametersDescriptionDeveloperSender account (an OpenID)Message creation time (integer)##MsgTypelocationLocation_XGeolocation dimensionLocation_YGeolocation accuracy ScaleMap zoom sizeLabelGeolocation informationMsgIdMessage id, 64-bit integer type

使用网页调试工具调试该接口

链接消息

<xml>
<tousername></tousername>
<fromusername></fromusername>
<createtime>1351776360</createtime>
<msgtype></msgtype>
<title></title>
<description></description>
<url></url>
<msgid>1234567890123456</msgid>
</xml>
ToUserName
WeChat ID FromUserName
CreateTime
参数 描述
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!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor