Overview
If you choose to develop a development version for WeChat, you cannot use the Custom menu tool in the function, and you need to add it manually using code. This article mainly introduces how to add a custom menu through http request.
Principles and Tools
If you want to add your own menu, you need to send a create menu message to a URL on WeChat. Just send once and your changes will be saved.
WeChat provides a debugging tool that can directly send the edited information to the corresponding URL. The address of the tool is here
Create Menu
First get the AccessToken. Children's shoes who don't know how to operate can refer to here
After getting the token, fill it in after the "access_token" of the tool, and then enter a format of json# in the body input box below. ##Text:
{ "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":"click", "name":"赞一下我们", "key":"V1001_GOOD" }] }] }
Share the example tutorial of mini program development and calling interface
2.The example code of mini program red envelope interface development
3.Detailed explanation of mini program development using Underscore.js
4.WeChat public account development tutorial Part 14 - Custom menu creation and menu event response
5.Simple example code for small program development
The above is the detailed content of How to add custom menu via http request?. For more information, please follow other related articles on the PHP Chinese website!