# Query custom menu information

Debugging Tools

Interface should be called on the server side, not in the front end (Weixin Mini Program, web pages, APP, etc.) directly called, specific reference interface call guide

Interface name: getCurrentSelfmenuInfo

This interface provides the configuration of the custom menu currently used by Official Account,If the Official Account message template is set through the API call menu, then the development configuration of the menu is returned. If the Official Account message template is released through the website function in the official website of the public platform, then this interface returns the menu configuration set by the operator.

# 1. How to call

# HTTPS calls

GET https://api.weixin.qq.com/cgi-bin/get_current_selfmenu_info?access_token=ACCESS_TOKEN

# Cloud Calls

  • Call method: officialAccount.menu.getSelfMenu

  • The input and exit parameters are the same as the HTTPS call, which can be called in the cloud call documentation

# Third party invocation

  • This interface supports Third Party Platform generation business call.

  • The permissions set to which this interface belongs are: 1, 3, 15

  • When a service provider is authorized by one of the permissions set, it can call on behalf of the merchant by using authorizer_access_token , which can be viewed in the third-party call documentation.

# 2. Request parameters

# Query parametersQuery String parameters

Parameter NametypeRequired to fill inExampleIntroductions
access_tokenstringyesACCESS_TOKENInterface invocation credentials, using access_token , authorizer_access_token

# Request BodyRequest Payload

nothing

# 3. Return Parameters

# Response Payload

Parameter NametypeExampleIntroductionsto enumerate
is_menu_opennumber0Whether the menu is open or not. 0 means not open, 1 means open0 1
selfmenu_infoobject-Menu Information-

# Res.selfmenu_infoObject Payload

Menu Information

Parameter NametypeIntroductions
buttonobjarrayMenu Button

# Res.selfmenu_info.button(Array)Object Payload

Menu Button

Parameter NametypeExampleIntroductions
typestringclickType of menu, specific reference to the description of the new API
namestringSongs of the dayMenu Name
valuestring-For different menu types, the value of value is different. Custom menu set on the website: Text: Save text to value; Img, voice: save mediaID to value; Video: Save the video download link to value; News: Save the graphic message to news_info, and save the mediaID to value; View: Save the link to the url. Custom menus set up using the API:click、scancode_push、scancode_waitmsg、pic_sysphoto、pic_photo_or_album、Pic_weixin, location_select: Save value to key; View: Save link to url
urlstring-For different menu types, the value of value is different. Custom menu set on the website: Text: Save text to value; Img, voice: save mediaID to value; Video: Save the video download link to value; News: Save the graphic message to news_info, and save the mediaID to value; View: Save the link to the url. Custom menus set up using the API:click、scancode_push、scancode_waitmsg、pic_sysphoto、pic_photo_or_album、Pic_weixin, location_select: Save value to key; View: Save link to url
keystring-For different menu types, the value of value is different. Custom menu set on the website: Text: Save text to value; Img, voice: save mediaID to value; Video: Save the video download link to value; News: Save the graphic message to news_info, and save the mediaID to value; View: Save the link to the url. Custom menus set up using the API:click、scancode_push、scancode_waitmsg、pic_sysphoto、pic_photo_or_album、Pic_weixin, location_select: Save value to key; View: Save link to url
news_infoobject-Information about the text message

# Res.selfmenu_info.button(Array).news_infoObject Payload

Information about the text message

Parameter NametypeIntroductions
listobjarrayGraphic message list

# Res.selfmenu_info.button(Array).news_info.listObject Payload

Graphic message list

Parameter NametypeIntroductionsto enumerate
titlestringtitle-
digeststringabstract-
authorstringAuthor-
show_covernumberShow the cover or not, 0 is not shown, 1 is shown0 1
cover_urlstringURL-
content_urlstringURL of the text-
source_url-The original URL, if left blank, there is no view of the original entry-

# 4. Note

  1. Third Party Platform Developers can use this interface toOfficial Account After authorizing the service to you, immediately detect the custom menu configuration of the Official Account message template through this interface, and set the automatic reply rule to the Official Account again through the interface, in order to improve the business experience of the Official Account operators.
  2. The difference between this interface and the custom menu query interface is that the custom menu query interface can only query the menu set by the API. This interface can not only view the menu set by using API, but also view the menu set by the account through the public platform official website (mp.weixin.qq.com).
  3. Authenticated / unauthenticated Service Account / Official Account, as well as the interface test number, have the interface permission.
  4. In terms of Third Party Platform's Official Account login authorization mechanism, this interface belongs to the message and menu permission set.
  5. Images / Voices / Videos returned in this interface are temporary materials (temporary materials are different each time they are retrieved and are valid for 3 days. These materials are obtained through the Content Management - Getting temporary materials interface). The visual message returned by this interface is a permanent material item (which is obtained through the Material Management - Getting Permanent Material Interface).

# 5. Code examples

# 5.1 Example of the official website settings menu

Example Requests

{}

Return an example

{
   "is_menu_open": 1,
   "selfmenu_info": {
       "button": [
           {
               "name": "button",
               "sub_button": {
                   "list": [
                       {
                           "type": "view",
                           "name": "view_url",
                           "url": "http://www.qq.com"
                       },
                       {
                           "type": "news",
                           "name": "news",
                           "value":"KQb_w_Tiz-nSdVLoTV35Psmty8hGBulGhEdbb9SKs-o",
                           "news_info": {
                               "list": [
                                   {
                                       "title": "MULTI_NEWS",
                                       "author": "JIMZHENG",
                                       "digest": "text",
                                       "show_cover": 0,
                                       "cover_url": "http://mmbiz.qpic.cn/mmbiz/GE7et87vE9vicuCibqXsX9GPPLuEtBfXfK0HKuBIa1A1cypS0uY1wickv70iaY1gf3I1DTszuJoS3lAVLvhTcm9sDA/0",
                                       "content_url": "http://mp.weixin.qq.com/s?__biz=MjM5ODUwNTM3Ng==&mid=204013432&idx=1&sn=80ce6d9abcb832237bf86c87e50fda15#rd",
                                       "source_url": ""
                                   },
                                   {
                                       "title": "MULTI_NEWS1",
                                       "author": "JIMZHENG",
                                       "digest": "MULTI_NEWS1",
                                       "show_cover": 1,
                                       "cover_url": "http://mmbiz.qpic.cn/mmbiz/GE7et87vE9vicuCibqXsX9GPPLuEtBfXfKnmnpXYgWmQD5gXUrEApIYBCgvh2yHsu3ic3anDUGtUCHwjiaEC5bicd7A/0",
                                       "content_url": "http://mp.weixin.qq.com/s?__biz=MjM5ODUwNTM3Ng==&mid=204013432&idx=2&sn=8226843afb14ecdecb08d9ce46bc1d37#rd",
                                       "source_url": ""
                                   }
                               ]
                           }
                       },
                       {
                           "type": "video",
                           "name": "video",
                           "value": "http://61.182.130.30/vweixinp.tc.qq.com/1007_114bcede9a2244eeb5ab7f76d951df5f.f10.mp4?vkey=77A42D0C2015FBB0A3653D29C571B5F4BBF1D243FBEF17F09C24FF1F2F22E30881BD350E360BC53F&sha=0&save=1"
                       },
                       {
                           "type": "voice",
                           "name": "voice",
                           "value": "nTXe3aghlQ4XYHa0AQPWiQQbFW9RVtaYTLPC1PCQx11qc9UB6CiUPFjdkeEtJicn"
                       }
                   ]
               }
           },
           {
               "type": "text",
               "name": "text",
               "value": "This is text!"
           },
           {
               "type": "img",
               "name": "photo",
               "value": "ax5Whs5dsoomJLEppAvftBUuH7CgXCZGFbFJifmbUjnQk_ierMHY99Y5d2Cv14RD"
           }
       ]
   }
}

# 5.2 API Setup Menu Example

Example Requests

{}

Return an example

{
   "is_menu_open": 1,
   "selfmenu_info": {
       "button": [
           {
               "type": "click",
               "name": "今日歌曲",
               "key": "V1001_TODAY_MUSIC"
           },
           {
               "name": "菜单",
               "sub_button": {
                   "list": [
                       {
                           "type": "view",
                           "name": "搜索",
                           "url": "http://www.soso.com/"
                       },
                       {
                           "type": "view",
                           "name": "视频",
                           "url": "http://v.qq.com/"
                       },
                       {
                           "type": "click",
                           "name": "赞一下我们",
                           "key": "V1001_GOOD"
                       }
                   ]
               }
           }
       ]
   }

# 6. Error code

The following is a list of error codes for this interface, other error codes can refer to General error codes

Error codeError DescriptionSolutions
-1system errorThe system is busy, so the developer is asked to try again in a few minutes.
40001invalid credential  access_token isinvalid or not latestaccess_token Invalid or not recently acquired access_token, please confirm the validity of the access_token

# 7. Scope of application

How this interface can be invoked under different account types:
Official Account Service Account
  • ✔: The account can call this interface
  • Other account types that are not expressly stated may not be called on this interface without special instructions;