WeChat 공개 플랫폼 개발자 문서 / 获取自定义菜单配置接口

获取自定义菜单配置接口

获取自定义菜单配置接口



本接口将会提供公众号当前使用的自定义菜单的配置,如果公众号是通过API调用设置的菜单,则返回菜单的开发配置,而如果公众号是在公众平台官网通过网站功能发布菜单,则本接口返回运营者设置的菜单配置。

请注意:

1、第三方平台开发者可以通过本接口,在旗下公众号将业务授权给你后,立即通过本接口检测公众号的自定义菜单配置,并通过接口再次给公众号设置好自动回复规则,以提升公众号运营者的业务体验。
2、本接口与自定义菜单查询接口的不同之处在于,本接口无论公众号的接口是如何设置的,都能查询到接口,而自定义菜单查询接口则仅能查询到使用API设置的菜单配置。
3、认证/未认证的服务号/订阅号,以及接口测试号,均拥有该接口权限。
4、从第三方平台的公众号登录授权机制上来说,该接口从属于消息与菜单权限集。
5、本接口中返回的图片/语音/视频为临时素材(临时素材每次获取都不同,3天内有效,通过素材管理-获取临时素材接口来获取这些素材),本接口返回的图文消息为永久素材素材(通过素材管理-获取永久素材接口来获取这些素材)。

接口调用请求说明

http请求方式: GET(请使用https协议)https://api.weixin.qq.com/cgi-bin/get_current_selfmenu_info?access_token=ACCESS_TOKEN

返回结果说明

如果公众号是在公众平台官网通过网站功能发布菜单,则本接口返回的自定义菜单配置样例如下:

{ 
   "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"
           }
       ]
   }
}

如果公众号是通过API调用设置的菜单,自定义菜单配置样例如下:

{ 
   "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"
                       }
                   ]
               }
           }
       ]
   }
}

参数说明

<tr class="firstRow thead"<th class="table_cell"">说明


QQ截图20170207155527.png


1474853296260004.jpg