步骤一:选到“开发者中心”。AppID和AppSecret,完整显示(要微信扫一下),去“微信公众平台接口调试工具”,
选到“基础支持”- “获取access_token接口/token”,填写“appid”和“secret”,点击“检查问题”。
微信公众平台接口调试工具 https://mp.weixin.qq.com/debug/cgi-bin/apiinfo?t=index
步骤二:到“微信公众平台接口调试工具”
选到“自定义菜单” - “自定义菜单创建接口/menu/create”,填写“access_token”
“body”的内容格式如下:
{
"button": [
{
"type": "click",
"name": "今日歌曲",
"key": "V1001_TODAY_MUSIC"
},
{
"name": "菜单",
"sub_button": [
{
"type": "view",
"name": "搜索",
"url": "http://www.soso.com/"
},
{
"type": "view",
"name": "视频",
"url": "http://v.qq.com/"
}
]
},
{
"type": "miniprogram",
"name": "个人中心",
"url": "https://open.weixin.qq.com/connect/oauth2/authorize?appid=***********redirect_uri=*********response_type=codescope=snsapi_basestate=patientInfo#wechat_redirect",
"sub_button": [],
"appid": "****************",
"pagepath": "pages/my/my-home/index"
},
{
"type": "view",
"name": "在线客服",
"url": "https://work.weixin.qq.com/****************",
"sub_button": []
}
]
}
点击“检查问题”
返回errcode:0,表示成功。
官方api:https://developers.weixin.qq.com/doc/offiaccount/Custom_Menus/Creating_Custom-Defined_Menu.html
另外说明:
如果要更新菜单,可以调删除出接口,在调创建接口。
清缓存方法:取消关注,再重新关注。