In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces the example analysis of the menu development of C# Wechat public platform, which has a certain reference value. Interested friends can refer to it. I hope you can learn a lot after reading this article. Now let the editor take you to know about it.
Obtain the ACCESS_ token value according to the developer AppID (application ID) and AppSecret (application key). The request address is https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx69e10a281a17e81f&secret=cff1fa9d984a3d122cadfbb901ecfa32, where "wx69e10a281a17e81f" is the appid of Wechat circle, and "cff1fa9d984a3d122cadfbb901ecfa32" is the AppSecret of Wechat circle. After obtaining the ACCESS_TOKEN, the menu request address is: https://api.weixin.qq.com/cgi-bin/menu/create?access_token= value. Replace the obtained ACCESS_ token value into the link address to create a set of menus.
Menu creation format:
{"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 ":" view " "name": "Video", "url": "http://v.qq.com/"}, {" type ":" click "," name ":" praise us " "key": "V1001_GOOD"}]}]}
If this is not the first time to create a menu, you need to delete the existing menu before creating the menu. The request address for deleting the menu is: https://api.weixin.qq.com/cgi-bin/menu/delete?access_token= value. Replace the obtained ACCESS_ token value into the link address to delete the existing menu.
Example:
Menu create clips:
String postString = "{\" button\ ": [{\" name\ ":\" message Express\ ",\" sub_button\ ": [{\" type\ ":\" click\ ",\" name\ ":\" revision notice\ ",\" key\ ":\" RevisionNotice\ "}, {\" type\ ":\" view\ ",\" name\ ":\" read good books in spring\ " \ "url\":\ "http://ah.10086.cn/new/s/ydty/ctdhsxscd\"}}, {\ "name\":\ "I want to share\",\ "sub_button\": [{\ "type\":\ "click\",\ "name\":\ "read a good book\",\ "key\":\ "bookRanking\"}, {\ "type\":\ "click\",\ "name\":\ "listen to Cool Voice\" \ "key\":\ "musicRanking\"}, {\ "type\":\ "click\",\ "name\":\ "fun Tour\",\ "key\":\ "gameRanking\"]}, {\ "name\":\ "personal Center\",\ "sub_button\": [{\ "type\":\ "click\",\ "name\":\ "Authentication\",\ "key\":\ "BDClick\" {\ "type\":\ "click\",\ "name\":\ "Credit Exchange\",\ "key\":\ "OnExchange\"}, {\ "type\":\ "click\",\ "name\":\ "Credit Rule description\",\ "key\":\ "IntegralRule\"}]} " / / Wechat Circle menu
Byte [] postData = Encoding.UTF8.GetBytes (postString); / / Encoding, especially Chinese characters, need to see the encoding method of crawling web pages in advance.
String url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=LZTCC_eaEHVsEh9pEczSYqGzrphoCsSiTtkbMwDj5yqkQVlP3rObDxxIm6J7cG39mLljSw9H18efkwEK0dHrCTlbKBXOJf2BHFuNZ4MZRBM";// creates a menu in the link based on the obtained ACCESS_ token value
WebClient webClient = new WebClient ()
WebClient.Headers.Add ("Content-Type", "application/x-www-form-urlencoded"); / / the header that must be added in POST mode. If you change it to GET mode, you can remove this sentence.
Byte [] responseData = webClient.UploadData (url, "POST", postData); / / get the returned character stream
String srcString = Encoding.UTF8.GetString (responseData); / / Decode
Response.Write (srcString)
Thank you for reading this article carefully. I hope the article "sample Analysis of menu Development of C# Wechat Public platform" shared by the editor will be helpful to you. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
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.