# Custom Menu Introduction
# 1. Overview
Custom menu can help Service Account enrich the interface, so that users better and faster to understand the function of the service number, the interface is shown:
# 2. The specific functions and server interface are as follows:
Interface Name | English name | Request Path |
---|---|---|
Create a custom menu | createCustomMenu | /cgi-bin/menu/create |
Query custom menu information | getCurrentSelfmenuInfo | /cgi-bin/get_current_selfmenu_info |
Get custom menu configuration | getMenu | /cgi-bin/menu/get |
Remove custom menus | deleteMenu | /cgi-bin/menu/delete |
Create personalized menus | addConditionalMenu | /cgi-bin/menu/addconditional |
Delete personalized menus | deleteConditionalMenu | /cgi-bin/menu/delconditional |
Test personalized menu matching results | tryMatchMenu | /cgi-bin/menu/trymatch |
# 3. The event push of the custom menu is as follows:
When the user clicks on the custom menu, WeChat will push the click event to the developer. Please note that clicking on the menu will pop up a submenu and will not generate a report. Please note that all events from 3 to 8 are only supported for WeChat users of WeChat iPhone 5.4.1 and Android 5.4. Older WeChat users will not receive a response after clicking, and developers will not receive event pushes normally.
# 3.1 Event push when you click on the menu to pull a message
Push XML digital packet example:
<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>
Parameter explaination:
parameter | describe |
---|---|
ToUserName | Developer No. WeChat |
FromUserName | Sender account (an OpenID) |
CreateTime | Message Creation Time (integer) |
MsgType | Message type, event |
Event | Event type, CLICK |
EventKey | Event KEY value, corresponding to the KEY value in the custom menu interface |
# 3.2 Event push when you click on a menu link to a link
Push XML digital packet example:
<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>
Parameter explaination:
parameter | describe |
---|---|
ToUserName | Developer No. WeChat |
FromUserName | Sender account (an OpenID) |
CreateTime | Message Creation Time (integer) |
MsgType | Message type, event |
Event | Event Type, VIEW |
EventKey | Event KEY value, set the jump URL |
MenuId | Refers to the menu ID, if it is a personalized menu, you can use this field to know which rule menu was clicked. |
# 3.3 Scan code_push: Scan code push event push
Push XML digital packet example:
<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>
Parameter explaination:
parameter | describe |
---|---|
ToUserName | Developer No. WeChat |
FromUserName | Sender account (an OpenID) |
CreateTime | Message Creation Time (integer) |
MsgType | Message type, event |
Event | Event type, scancode_push |
EventKey | Event KEY value, set by the developer when creating the menu |
ScanCodeInfo | Scan information |
ScanType | Scan type, usually qrcode |
ScanResult | Scan results, that is, the two-dimensional code corresponding to the character string information |
# 3.4 Scancode_waitmsg: Scan the code to push the event and pop up the "message received" prompt box to push the event
Push XML digital packet example:
<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>
Parameter explaination:
parameter | describe |
---|---|
ToUserName | Developer No. WeChat |
FromUserName | Sender account (an OpenID) |
CreateTime | Message Creation Time (integer) |
MsgType | Message type, event |
Event | Event type, scancode_waitmsg |
EventKey | Event KEY value, set by the developer when creating the menu |
ScanCodeInfo | Scan information |
ScanType | Scan type, usually qrcode |
ScanResult | Scan results, that is, the two-dimensional code corresponding to the character string information |
# 3.5 Pic_sysphoto: Event push to pop up the system to take pictures and send pictures
Push XML digital packet example:
<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>
Parameter explaination:
parameter | describe |
---|---|
ToUserName | Developer No. WeChat |
FromUserName | Sender account (an OpenID) |
CreateTime | Message Creation Time (integer) |
MsgType | Message type, event |
Event | Event type, pic_sysphoto |
EventKey | Event KEY value, set by the developer when creating the menu |
SendPicsInfo | Message of a picture sent |
Count | Number of images sent |
PicList | List of Pictures |
PicMd5Sum | The MD5 value of the image, which the developer can use to verify receipt of the image if required |
# 3.6 Pic_photo_or_album: Event push for pop-up photo or album posting
Push XML digital packet example:
<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>
Parameter explaination:
parameter | describe |
---|---|
ToUserName | Developer No. WeChat |
FromUserName | Sender account (an OpenID) |
CreateTime | Message Creation Time (integer) |
MsgType | Message type, event |
Event | Event type, pic_photo_or_album |
EventKey | Event KEY value, set by the developer when creating the menu |
SendPicsInfo | Message of a picture sent |
Count | Number of images sent |
PicList | List of Pictures |
PicMd5Sum | The MD5 value of the image, which the developer can use to verify receipt of the image if required |
# 3.7 Pic_weixin: Popping up the event push of WeChat Album Publisher
Push XML digital packet example:
<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>
Parameter explaination:
parameter | describe |
---|---|
ToUserName | Developer No. WeChat |
FromUserName | Sender account (an OpenID) |
CreateTime | Message Creation Time (integer) |
MsgType | Message type, event |
Event | Event type, pic_weixin |
EventKey | Event KEY value, set by the developer when creating the menu |
SendPicsInfo | Message of a picture sent |
Count | Number of images sent |
PicList | List of Pictures |
PicMd5Sum | The MD5 value of the image, which the developer can use to verify receipt of the image if required |
# 3.8 Location_select: Event push that pops up the location selector
Push XML digital packet example:
<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[ 广州市海珠区客村艺苑路 106号]]></Label>
<Poiname><![CDATA[]]></Poiname>
</SendLocationInfo>
</xml>
Parameter explaination:
parameter | describe |
---|---|
ToUserName | Developer No. WeChat |
FromUserName | Sender account (an OpenID) |
CreateTime | Message Creation Time (integer) |
MsgType | Message type, event |
Event | Event type, location_select |
EventKey | Event KEY value, set by the developer when creating the menu |
SendLocationInfo | Sent location information |
Location_X | X coordinate information |
Location_Y | Y coordinate information |
Scale | Precision, can be understood as precision or scale, the more precise the scale is higher |
Label | Character string information for geographic location |
Poiname | WeChat MomentsPOI name, may be empty |
# 3.9 Click on the menu to jump Weixin Mini Program
Push XML digital packet example:
<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>
Parameter explaination:
parameter | describe |
---|---|
ToUserName | Developer No. WeChat |
FromUserName | Sender account (an OpenID) |
CreateTime | Message Creation Time (integer) |
MsgType | Message type, event |
Event | Event type, view_miniprogram |
EventKey | Event KEY value, Weixin Mini Program path of the jump |
MenuId | Menu ID, if it is a personalized menu, you can use this field to know which rule menu was clicked |