public static WechatResponseWrapper CreateCustomMenu(String acessToken, WechatMenuButtonSet menu) { //https://api.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS_TOKEN String reqUrl = String.Format("https://api.weixin.qq.com/cgi-bin/menu/create?access_token={0}", acessToken); JsonSerializerSettings settings = new JsonSerializerSettings(); settings.NullValueHandling = NullValueHandling.Ignore; String respText = new Curl().Post(reqUrl, JsonConvert.SerializeObject(menu, settings)); return new WechatResponseWrapper(reqUrl, respText); }
public JsonResult CreateMenu(WechatMenuButton button) { var buttonSet = new WechatMenuButtonSet(); buttonSet.button.Add(button); _wechatCustomApi.CreateCustomMenu(buttonSet); return Json(null); }
public void CreateCustomMenu(WechatMenuButtonSet buttons) { var result = WechatBasicApi.CreateCustomMenu(GetAccessToken().access_token, buttons); result.ThrowifFailed(); }