Custom menu management-custom menu creation interface

Custom menu management-custom menu creation interface

Currently, a custom menu can contain up to 3 first-level menus, and each first-level menu can contain up to 5 second-level menus. A first-level menu can contain up to 4 Chinese characters, and a second-level menu can contain up to 7 Chinese characters. The extra characters will be replaced by "...". Please note that after creating a custom menu, it will take 24 hours for the WeChat client to display it due to the WeChat client cache. It is recommended that you try to unfollow the public account and then follow it again during testing, so that you can see the effect after creation.

The custom menu interface can implement various types of buttons, as follows:

1. click: click push event

When the user clicks a click type button, the WeChat server will push a message structure of event type to the developer through the message interface (refer to the message interface guide), and bring the key value filled in by the developer in the button. The developer can interact with the user through the customized key value;

2. view: jump to URL

After the user clicks a view type button, the WeChat client will open the web URL filled in by the developer in the button, which can be combined with the web page authorization to obtain the user's basic information interface to obtain the user's basic information.

3. scancode_push: scan code push event

After the user clicks the button, the WeChat client will call up the scanning tool. After completing the scanning operation, the scanning result will be displayed (if it is a URL, the URL will be entered), and the scanning result will be transmitted to the developer, who can then send a message.

4. scancode_waitmsg: Scan the code to push the event and pop up the "Message Receiving" prompt box

After the user clicks the button, the WeChat client will call up the scanning tool. After completing the scanning operation, it will transmit the scanning result to the developer and close the scanning tool. Then a "Message Receiving" prompt box will pop up, and the user may then receive a message from the developer.

5. pic_sysphoto: pop-up system to take pictures and send pictures

After the user clicks the button, the WeChat client will call up the system camera. After completing the photo-taking operation, it will send the taken photo to the developer and push an event to the developer. At the same time, the system camera will be closed, and the developer may receive a message from the developer afterwards.

6. pic_photo_or_album: pop up to take a photo or send a photo to the album

After the user clicks the button, the WeChat client will pop up a selector for the user to choose "take a photo" or "select from the phone album". After the user makes a choice, the other two processes will be followed.

7. pic_weixin: pop up WeChat photo album sender

After the user clicks the button, the WeChat client will call up the WeChat album. After completing the selection operation, it will send the selected photos to the developer's server and push events to the developer. At the same time, the album will be closed, and the user may then receive a message from the developer.

8. location_select: Pop-up location selector

After the user clicks the button, the WeChat client will call up the location selection tool. After completing the selection operation, the selected location will be sent to the developer's server and the location selection tool will be closed. The user may then receive a message from the developer.

Please note that all events from 3 to 8 are only supported by WeChat iPhone version 5.4.1 and above, and WeChat users of Android version 5.4 and above. Users of old WeChat versions will not receive any response after clicking, and developers will not be able to receive event push normally.

Interface call request description

http request method: POST (please use https protocol) https://api.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS_TOKEN

Click and view request examples

  1. {
  2. "button" :[
  3. {
  4. "type" : "click" ,
  5. "name" : "Today's Song" ,
  6. "key" : "V1001_TODAY_MUSIC"  
  7. },
  8. {
  9. "name" : "Menu" ,
  10. "sub_button" :[
  11. {
  12. "type" : "view" ,
  13. "name" : "Search" ,
  14. "url" : "http://www.soso.com/"  
  15. },
  16. {
  17. "type" : "view" ,
  18. "name" : "Video" ,
  19. "url" : "http://v.qq.com/"  
  20. },
  21. {
  22. "type" : "click" ,
  23. "name" : "Like us" ,
  24. "key" : "V1001_GOOD"  
  25. }]
  26. }]
  27. }

Request examples for other newly added button types

  1. {
  2. "button" : [
  3. {
  4. "name" : "Scan QR code" ,
  5. "sub_button" : [
  6. {
  7. "type" : "scancode_waitmsg" ,
  8. "name" : "Scan code with prompts" ,
  9. "key" : "rselfmenu_0_0" ,
  10. "sub_button" : [ ]
  11. },
  12. {
  13. "type" : "scancode_push" ,
  14. "name" : "Scan QR code push event" ,
  15. "key" : "rselfmenu_0_1" ,
  16. "sub_button" : [ ]
  17. }
  18. ]
  19. },
  20. {
  21. "name" : "Post a picture" ,
  22. "sub_button" : [
  23. {
  24. "type" : "pic_sysphoto" ,
  25. "name" : "System takes pictures and sends them" ,
  26. "key" : "rselfmenu_1_0" ,
  27. "sub_button" : [ ]
  28. },
  29. {
  30. "type" : "pic_photo_or_album" ,
  31. "name" : "Take a photo or send it to your photo album" ,
  32. "key" : "rselfmenu_1_1" ,
  33. "sub_button" : [ ]
  34. },
  35. {
  36. "type" : "pic_weixin" ,
  37. "name" : "WeChat photo album post" ,
  38. "key" : "rselfmenu_1_2" ,
  39. "sub_button" : [ ]
  40. }
  41. ]
  42. },
  43. {
  44. "name" : "Send Location" ,
  45. "type" : "location_select" ,
  46. "key" : "rselfmenu_2_0"  
  47. }
  48. ]
  49. }

Return results

The correct returned JSON data packet is as follows:

{"errcode":0,"errmsg":"ok"}

The returned JSON data packet in case of an error is as follows (the example shows the invalid menu name length):

{"errcode":40018,"errmsg":"invalid button name size"}

<<:  Status bar prompts with various effects

>>:  Data statistics interface-graphic and text analysis data interface

Recommend

WeChat applet development practice - using UUID, Base64, Chance, etc.

[[173391]] UUID The node-uuid module can quickly ...

2020 Zhihu Analysis Report

Recently, the business direction of the docking h...

China Automobile Dealers Association: US auto market bounced in May 2020

“America’s auto dealers are getting people back t...

How to make your "promotional activities" a big hit?

Everyone should have had this feeling: when you a...

APP Marketing Must-Read: Some Popular Advertising Formats Explained

APPs are one of the most influential innovations ...

Operating systems other than iOS, Android, and WP?

[[138339]] Sources revealed that Samsung will use...

Promoting activation and retention: analysis of user growth system design

1. What is the user growth system? The evolution ...