How to use custom menus in WeChat Enterprise Account Development

How to use custom menus in WeChat Enterprise Account Development

Each application in the enterprise account can have its own menu, and the enterprise can call the interface to create, delete, and obtain the application menu.

Note that when operating the application menu, the application must be in callback mode; the menu can have a maximum of two levels, a maximum of 3 first-level menus, and a maximum of 5 second-level menus .

1. Create an application menu

  • Request Instructions

Https request method: POST

https://qyapi.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS_TOKEN&agentid=1

The request packet is as follows:

  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" : "click" ,
  18. "name" : "Like us" ,
  19. "key" : "V1001_GOOD"  
  20. }
  21. ]
  22. }
  23. ]
  24. }
  • Parameter Description
parameter must illustrate
access_token yes Call interface credentials
agentid yes The id of the enterprise application, integer. You can view it on the application settings page.
button yes First-level menu array, the number should be 1~3
sub_button no Secondary menu array, the number should be 1~5
type yes The response action type of the menu, currently there are two types: click and view
name yes Menu title, no more than 16 bytes, submenu no more than 40 bytes
key click type required Menu KEY value, used for message interface push, no more than 128 bytes
url The view type must Web link. Employees can open the link by clicking the menu. No more than 256 bytes
  • Permissions

The administrator must have management permissions for the application, and the application must be set in callback mode.

Return results

  1. {
  2. "errcode" : 0 ,
  3. "errmsg" : "ok"  
  4. }

2. Delete Menu

  • Request Instructions

Https request method: GET

https://qyapi.weixin.qq.com/cgi-bin/menu/delete?access_token=ACCESS_TOKEN&agentid=1

  • Parameter Description
parameter must illustrate
access_token yes Call interface credentials
agentid yes The id of the enterprise application, integer. You can view it on the application settings page.
  • Permissions

The administrator must have management permissions for the application, and the application must be set in callback mode.

  • Return results
  1. {
  2. "errcode" : 0 ,
  3. "errmsg" : "ok"  
  4. }

3. Get the menu list

  • Request Instructions

Https request method: GET

https://qyapi.weixin.qq.com/cgi-bin/menu/get?access_token=ACCESS_TOKEN&agentid=1

  • Parameter Description
parameter must illustrate
access_token yes Call interface credentials
agentid yes The id of the enterprise application, integer. You can view it on the application settings page.
  • Permissions

The administrator must have management permissions for the application, and the application must be set in callback mode.

  • Return results

The returned result is consistent with the parameters used to create the menu.

<<:  Android Getting Started - Button Control + Custom Button Control

>>:  How to obtain OAuth2 authentication interface in WeChat Enterprise Account Development

Recommend

Yu Yang of Analysys: Data is the new energy in the future Internet world

On March 19, Analysys officially launched its dat...

What has changed in WeChat in the past eleven years?

On January 6, 2022, the WeChat team’s annual WeCh...

What would happen if the FBI hacked an Android phone?

According to CNN Money, multiple sources indicate ...

Basic knowledge of POS machines, understand POS machine knowledge

The POS machine used always jumps code, which caus...

From Objective-C to Swift: Some Thoughts and Opinions

In this post I want to talk to you about my recen...

Without the Sahara Desert, perhaps there would be no Amazon rainforest?

Review expert: Ye Haiying, deputy director of the...

Jia Yueting counts to "3" and LeTV's "super phone" is ready to be released

January 7 (Reporter Zhang Xiaodong) A company tha...

Analysis of Estee Lauder’s Double 11 marketing strategy!

In the fiercely competitive beauty industry, majo...

How does Zhihu monetize? Zhihu monetization skills!

I wrote the first answer on Zhihu , which unexpec...

213,900-329,900! The first choice for elite families, Haobo HT high-gloss launch

As elite families continue to grow and develop, t...

The hoopoe's Mohawk hairstyle is actually showing off "I stink!"?

The hoopoe (Upupa epops), one of the most widespr...

Dog Brother's Notes-Short Video System Thinking + Practical System Course

The course comes from the mutual aid course collec...

The price of iPhone 6's ultra-thinness: big trouble!

The iPhone 6 will be extremely thin and light. The...