After a user taps the custom menu, WeChat will push the tap event to the developer. Note that tapping the menu opens the sub-menu and no report will be triggered. Events 3 to 8 are supported as of WeChat 5.4.1 for iOS and WeChat 5.4 for Android. In older versions, no response is returned and no event will be sent to the developer after the user taps the appropriate button.

Contents

1 Event of tapping menu to pull message

2 Event of tapping menu to redirect to URL

3 scancode_push: Event of pushing event when code is scanned

4 scancode_waitmsg: Event of pushing event and displaying "Receiving message" when code is scanned

5 pic_sysphoto: Event of sending image by taking photo with system camera

6 pic_photo_or_album: Event of sending image by taking photo with system camera

7 pic_weixin: Event of sending image by selecting from WeChat album

8 location_select: Event of displaying geographic location selector

9 Event of tapping menu to redirect to Mini Program

Event of Tapping Menu To Pull Message

Example of pushing an XML data packet:

<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[FromUser]]></FromUserName>
<CreateTime>123456789</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[CLICK]]></Event>
<EventKey><![CDATA[EVENTKEY]]></EventKey>
</xml>

Parameters:

Parameter Description
ToUserName Developer's WeChat ID
FromUserName Sender ID (OpenID)
CreateTime Creation time of message (integer)
MsgType Message type (event)
Event Event type (CLICK)
EventKey Event key, which corresponds to the key in the custom menu API

Event of Tapping Menu to Redirect to URL

Example of pushing an XML data packet:

<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[FromUser]]></FromUserName>
<CreateTime>123456789</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[VIEW]]></Event>
<EventKey><![CDATA[www.qq.com]]></EventKey>
<MenuId>MENUID</MenuId>
</xml>

Parameters:

Parameter Description
ToUserName Developer's WeChat ID
FromUserName Sender ID (OpenID)
CreateTime Creation time of message (integer)
MsgType Message type (event)
Event Event type (VIEW)
EventKey Event key, which is the URL to be redirected to
MenuID Menu ID. If a custom menu is used, this field can be used to identify which menu is tapped.

scancode_push: Event of Pushing Event When Code is Scanned

Example of pushing an XML data packet:

<xml><ToUserName><![CDATA[gh_e136c6e50636]]></ToUserName>
<FromUserName><![CDATA[oMgHVjngRipVsoxg6TuX3vz6glDg]]></FromUserName>
<CreateTime>1408090502</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[scancode_push]]></Event>
<EventKey><![CDATA[6]]></EventKey>
<ScanCodeInfo><ScanType><![CDATA[qrcode]]></ScanType>
<ScanResult><![CDATA[1]]></ScanResult>
</ScanCodeInfo>
</xml>

Parameters:

Parameter Description
ToUserName Developer's WeChat ID
FromUserName Sender ID (OpenID)
CreateTime Creation time of message (integral)
MsgType Message type (event)
Event Event type (scancode_push)
EventKey Event key, which is set by the developer when creating a menu
ScanCodeInfo Scan information
ScanType Scan type, which is generally qrcode
ScanResult Scan result, which is the string information corresponding to the QR code

scancode_waitmsg: Event of Pushing Event and Displaying "Receiving Message" When Code is Scanned

Example of pushing an XML data packet:

<xml><ToUserName><![CDATA[gh_e136c6e50636]]></ToUserName>
<FromUserName><![CDATA[oMgHVjngRipVsoxg6TuX3vz6glDg]]></FromUserName>
<CreateTime>1408090606</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[scancode_waitmsg]]></Event>
<EventKey><![CDATA[6]]></EventKey>
<ScanCodeInfo><ScanType><![CDATA[qrcode]]></ScanType>
<ScanResult><![CDATA[2]]></ScanResult>
</ScanCodeInfo>
</xml>

Parameters:

Parameter Description
ToUserName Developer's WeChat ID
FromUserName Sender ID (OpenID)
CreateTime Creation time of message (integer)
MsgType Message type (event)
Event Event type (scancode_waitmsg)
EventKey Event key, which is set by the developer when creating a menu
ScanCodeInfo Scan information
ScanType Scan type, which is generally qrcode
ScanResult Scan result, which is the string information corresponding to the QR code

pic_sysphoto: Event of Sending Image by Taking Photo with System Camera

Example of pushing an XML data packet:

<xml><ToUserName><![CDATA[gh_e136c6e50636]]></ToUserName>
<FromUserName><![CDATA[oMgHVjngRipVsoxg6TuX3vz6glDg]]></FromUserName>
<CreateTime>1408090651</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[pic_sysphoto]]></Event>
<EventKey><![CDATA[6]]></EventKey>
<SendPicsInfo><Count>1</Count>
<PicList><item><PicMd5Sum><![CDATA[1b5f7c23b5bf75682a53e7b6d163e185]]></PicMd5Sum>
</item>
</PicList>
</SendPicsInfo>
</xml>

Parameters:

Parameter Description
ToUserName Developer's WeChat ID
FromUserName Sender ID (OpenID)
CreateTime Creation time of message (integer)
MsgType Message type (event)
Event Event type (pic_sysphoto)
EventKey Event key, which is set by the developer when creating a menu
SendPicsInfo Information of image sent
Count Number of images sent
PicList Image list
PicMd5Sum MD5 value of image, which can be used to verify received images if needed

pic_photo_or_album: Event of Sending Image by Taking Photo with System Camera

Example of pushing an XML data packet:

<xml><ToUserName><![CDATA[gh_e136c6e50636]]></ToUserName>
<FromUserName><![CDATA[oMgHVjngRipVsoxg6TuX3vz6glDg]]></FromUserName>
<CreateTime>1408090816</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[pic_photo_or_album]]></Event>
<EventKey><![CDATA[6]]></EventKey>
<SendPicsInfo><Count>1</Count>
<PicList><item><PicMd5Sum><![CDATA[5a75aaca956d97be686719218f275c6b]]></PicMd5Sum>
</item>
</PicList>
</SendPicsInfo>
</xml>

Parameters:

Parameter Description
ToUserName Developer's WeChat ID
FromUserName Sender ID (OpenID)
CreateTime Creation time of message (integer)
MsgType Message type (event)
Event Event type (pic_photo_or_album)
EventKey Event key, which is set by the developer when creating a menu
SendPicsInfo Information of image sent
Count Number of images sent
PicList Image list
PicMd5Sum MD5 value of image, which can be used to verify received images if needed

pic_weixin: Event of Sending Image by Selecting from WeChat Album

Example of pushing an XML data packet:

<xml><ToUserName><![CDATA[gh_e136c6e50636]]></ToUserName>
<FromUserName><![CDATA[oMgHVjngRipVsoxg6TuX3vz6glDg]]></FromUserName>
<CreateTime>1408090816</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[pic_weixin]]></Event>
<EventKey><![CDATA[6]]></EventKey>
<SendPicsInfo><Count>1</Count>
<PicList><item><PicMd5Sum><![CDATA[5a75aaca956d97be686719218f275c6b]]></PicMd5Sum>
</item>
</PicList>
</SendPicsInfo>
</xml>

Parameters:

Parameter Description
ToUserName Developer's WeChat ID
FromUserName Sender ID (OpenID)
CreateTime Creation time of message (integer)
MsgType Message type (event)
Event Event type (pic_weixin)
EventKey Event key, which is set by the developer when creating a menu
SendPicsInfo Information of image sent
Count Number of images sent
PicList Image list
PicMd5Sum MD5 value of image, which can be used to verify received images if needed

location_select: Event of Displaying Geographic Location Selector

Example of pushing an XML data packet:

<xml><ToUserName><![CDATA[gh_e136c6e50636]]></ToUserName>
<FromUserName><![CDATA[oMgHVjngRipVsoxg6TuX3vz6glDg]]></FromUserName>
<CreateTime>1408091189</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[location_select]]></Event>
<EventKey><![CDATA[6]]></EventKey>
<SendLocationInfo><Location_X><![CDATA[23]]></Location_X>
<Location_Y><![CDATA[113]]></Location_Y>
<Scale><![CDATA[15]]></Scale>
<Label><![CDATA[ No. 106, Yiyuan Road, Kecun, Haizhu District, Guangzhou]]></Label>
<Poiname><![CDATA[]]></Poiname>
</SendLocationInfo>
</xml>

Parameters:

Parameter Description
ToUserName Developer's WeChat ID
FromUserName Sender ID (OpenID)
CreateTime Creation time of message (integer)
MsgType Message type (event)
Event Event type (location_select)
EventKey Event key, which is set by the developer when creating a menu
SendLocationInfo Information of location sent
Location_X X-coordinate
Location_Y Y-coordinate
Scale Accuracy or scale. A higher accuracy indicates higher scale.
Label String information of geographic location
Poiname Moments POI name, which can be empty

Event of Tapping Menu to Redirect to Mini Program

Example of pushing an XML data packet:

<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[FromUser]]></FromUserName>
<CreateTime>123456789</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[view_miniprogram]]></Event>
<EventKey><![CDATA[pages/index/index]]></EventKey>
<MenuId>MENUID</MenuId>
</xml>

Parameters:

Parameter Description
ToUserName Developer's WeChat ID
FromUserName Sender ID (OpenID)
CreateTime Creation time of message (integer)
MsgType Message type (event)
Event Event type (view_miniprogram)
EventKey Event key, which is the Mini Program's path to be redirected to
MenuID Menu ID. If a personalized menu is used, this field can be used to identify which menu is tapped.