In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the knowledge of "how to customize the menu can help the official account enrich the interface". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations! I hope you can read it carefully and be able to achieve something!
Overview
Custom menus can help official accounts enrich the interface and enable users to understand the functions of official accounts better and faster.
Document definition
API call request description
Http request method: POST (please use https protocol) https://api.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS_TOKEN
Example of requests for click and view
{"button": [{"type": "click", "name": "Today's song", "key": "V1001_TODAY_MUSIC"}, {"name": "menu", "sub_button": [{"type": "view" "name": "search", "url": "http://www.soso.com/"}, {" type ":" miniprogram "," name ":" wxa "," url ":" http://mp.weixin.qq.com", " "appid": "wx286b93c14bbf93aa", "pagepath": "pages/lunar/index"}, {"type": "click", "name": "praise us", "key": "V1001_GOOD"}]}
Mode of realization
1. Define menu json document
{"button": [{"name": "Operation improvement", "sub_button": [{"type": "view", "name": "Free trial", "url": "https://acc.bqool.cn/freetrial"}, {" type ":" view " "name": "New AI Price Adjustment", "url": "https://www.bqool.cn/products/repricing-central/"}, {" type ":" view "," name ":" Hot Home Cool "," url ":" https://www.bqool.cn/bigcentral/"} " {"type": "view", "name": "Hot Choice Cool", "url": "https://www.bqool.cn/products/chrome-extension/"}, {" type ":" view "," name ":" more products.. " "url": "https://www.bqool.cn/"}]}, {" name ":" Cool Tsai tribe "," sub_button ": [{" type ":" view "," name ":" time-limited benefits " "url": "https://mp.weixin.qq.com/mp/video?__biz=MzIzMjc1NTY3MQ==&mid=100007240&sn=04973c15f924fc78a78fec50cd75d706&vid=wxv_1500216251938308102&idx=1&vidsn=a27a0d1d9503802f9f9095534d4d2507&fromid=1&xtrack=1&scene=0&subscene=10000&clicktime=1600054770&enterid=1600054770#wechat_redirect"}, {" type ":" view "," name ":" success stories " "url": "https://www.bqool.cn/user-stories/"}, {" type ":" view "," name ":" Teaching Video "," url ":" https://www.bqool.cn/video-tutorial/"}, {"type": "view" "name": "Tribal articles", "url": "https://mp.weixin.qq.com/mp/homepage?__biz=MzIzMjc1NTY3MQ==&hid=1&sn=db4536a338f0e128ce2e5db089f381e1&scene=18"}]}, {" name ":" Rights Center "," sub_button ": [{" type ":" view " "name": "check-in draw", "url": "http://u135069.s.24hwpro.com/web/game/game_id/1220189859"}, {" type ":" view "," name ":" Business Cooperation "," url ":" https://h6.eqxiul.com/ls/EyOfmUXk"} " {"type": "view", "name": "E-commerce Services", "url": "https://www.bqool.cn/seller-services/"}, {" type ":" view "," name ":" contact Cool " "url": "https://admin.qidian.qq.com/template/blue/mp/menu/qr-code-jump.html?linkType=0&env=ol&kfuin=2852161981&fid=95&key=71d05b6c5e0a545f0be22ec831f9d7af&cate=1&type=16&ftype=1&_type=wpa&qidian=true"}]}]}
2. Read json file
/ Custom menu / / [BQoolException] [HttpPost] public ApiResult CustomMenus (string CustomMenusPwd) {if (! string.IsNullOrWhiteSpace (CustomMenusPwd) & & CustomMenusPwd.Trim () = = MvcTools.GetAppSetting ("WeixinCustomMenus")) {CustomMenusParam param = new CustomMenusParam () {Account = "sys" UpdateUser = "sys"} Param.Jsonstr = WeiXinHelper.ReadAccess (HttpRuntime.AppDomainAppPath.ToString () + "/ App_Data/WeChat/Custom_Menus.json"); ApiResult result = _ weChatAlertsService.CustomMenus (param, AppId, Appsecret); return result } else {return new ApiResult () {Success = false, Code = ApiResultCode.InvalidError, ErrorMessage = ApiResultCode.ErrorMessages [ApiResultCode.InvalidError]};}}
3. Post submits data to Wechat server
Private static Tuple CustomMenus (string AppId, string Appsecret, string jsonstr, bool isResh) {var accessToken = TryGetAccessToken (AppId, Appsecret, isResh); string url = APIConfig.Custom_Menus (accessToken); string str = APIConfig.CreatePostHttpResponse (url, jsonstr); _ logger.Debug ("Custom menu\ r\ n" + "input:" + url + "\ r\ n" + jsonstr + "\ r\ noutput:" + str) Return new Tuple (JsonConvert.DeserializeObject (str), url, jsonstr);} public static string WEIXIN_URL = "https://api.weixin.qq.com/"; public static string Custom_Menus (string token) {return String.Format (WEIXIN_URL +" cgi-bin/menu/create?access_token= {0} ", token);}
Note: in general, whether you create or modify menus, you can use the "cgi-bin/menu/create" interface.
This is the end of the content of "how to customize the menu to help official accounts enrich the interface". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.