# Query custom menu information
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 Name | type | Required to fill in | Example | Introductions |
---|---|---|---|---|
access_token | string | yes | ACCESS_TOKEN | Interface invocation credentials, using access_token , authorizer_access_token |
# Request BodyRequest Payload
nothing
# 3. Return Parameters
# Response Payload
Parameter Name | type | Example | Introductions | to enumerate |
---|---|---|---|---|
is_menu_open | number | 0 | Whether the menu is open or not. 0 means not open, 1 means open | 0 1 |
selfmenu_info | object | - | Menu Information | - |
# Res.selfmenu_infoObject Payload
Menu Information
Parameter Name | type | Introductions |
---|---|---|
button | objarray | Menu Button |
# Res.selfmenu_info.button(Array)Object Payload
Menu Button
Parameter Name | type | Example | Introductions |
---|---|---|---|
type | string | click | Type of menu, specific reference to the description of the new API |
name | string | Songs of the day | Menu Name |
value | string | - | 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 |
url | string | - | 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 |
key | string | - | 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_info | object | - | Information about the text message |
# Res.selfmenu_info.button(Array).news_infoObject Payload
Information about the text message
Parameter Name | type | Introductions |
---|---|---|
list | objarray | Graphic message list |
# Res.selfmenu_info.button(Array).news_info.listObject Payload
Graphic message list
Parameter Name | type | Introductions | to enumerate |
---|---|---|---|
title | string | title | - |
digest | string | abstract | - |
author | string | Author | - |
show_cover | number | Show the cover or not, 0 is not shown, 1 is shown | 0 1 |
cover_url | string | URL | - |
content_url | string | URL of the text | - |
source_url | - | The original URL, if left blank, there is no view of the original entry | - |
# 4. Note
- 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.
- 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).
- Authenticated / unauthenticated Service Account / Official Account, as well as the interface test number, have the interface permission.
- In terms of Third Party Platform's Official Account login authorization mechanism, this interface belongs to the message and menu permission set.
- 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 code | Error Description | Solutions |
---|---|---|
-1 | system error | The system is busy, so the developer is asked to try again in a few minutes. |
40001 | invalid credential access_token isinvalid or not latest | access_token Invalid or not recently acquired access_token, please confirm the validity of the access_token |
# 7. Scope of application
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;