码迷,mamicode.com
首页 > 其他好文 > 详细

发送模板消息

时间:2015-11-30 17:44:39      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:

 public ActionResult SendMsg()
        {
            string token = getAccessToken(true"gh9ca2");
            string templateID = "ngqIpbwh8bUfcSsECmogfXcV14J0tQlEpBO27izEYtY";
            dynamic postData = new ExpandoObject();
            postData.touser = "OpenId";
            postData.template_id = templateID;
            postData.url = string.Empty;
            postData.topcolor = "#FF";
            postData.data = new ExpandoObject();
            var data = new[]
                {
                 new Tuple<stringstringstring>("title""商机提醒通知""#FF"),
                 new Tuple<stringstringstring>("trainNumber""通知主体""#FF"),
                 new Tuple<stringstringstring>("remark""感谢您关注我们""#FF")
                };
            var dataDict = (IDictionary<stringobject>)postData.data;
            foreach (var item in data)
            {
                dataDict.Add(item.Item1, new { value = item.Item2, color = item.Item3 });
            }
            JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
            string json = jsonSerializer.Serialize((object)postData);
            //string url = string.Format("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token={0}", token);
            string url = "";
            var result = Post("url", json);
            return View();
        }

发送模板消息

标签:

原文地址:http://www.cnblogs.com/nzcblog/p/5007635.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!