国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > C# > 正文

微信服務(wù)號推送模板消息接口

2020-01-24 01:34:35
字體:
供稿:網(wǎng)友

微信服務(wù)號現(xiàn)在用的比較火,用戶可以通過微信號訂閱信息,有時候會用到模板消息。下面貼上代碼,有注釋寫的很詳細(xì)。在此@access_token 請調(diào)用 https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=@appid&secret=@secret 接口獲取。

具體代碼:

public static void Send()   {    dynamic postData = new ExpandoObject();    postData.touser = "OpenId";    postData.template_id = "template_id";    postData.url = string.Empty;    postData.topcolor = "#FF";    postData.data = new ExpandoObject();    var data = new[]    {     new Tuple<string, string, string>("title", "航班延誤通知", "#FF"),     new Tuple<string, string, string>("trainNumber", "分鐘", "#FF"),     new Tuple<string, string, string>("fromto", "上海-北京", "#FF"),     new Tuple<string, string, string>("formerTime", "http:// ::", "#FF"),     new Tuple<string, string, string>("Time", "http:// ::", "#FF"),     new Tuple<string, string, string>("number", "分鐘", "#FF"),     new Tuple<string, string, string>("reason", "天氣原因", "#FF"),     new Tuple<string, string, string>("remark", "請關(guān)注我們的微信通知", "#FF")    };    var dataDict = (IDictionary<string, object>)postData.data;    foreach (var item in data)    {     dataDict.Add(item.Item, new { value = item.Item, color = item.Item });    }    string json = ((object)postData).Serialize();    Console.WriteLine(json);    var r = NetUtils.CreateHttpResponse(@"https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=@access_token", json);    Console.WriteLine(r);   }

以上就是本文針對微信服務(wù)號推送模板消息接口的全部內(nèi)容,希望對大家有所幫助。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 贺兰县| 东乌| 中牟县| 泰兴市| 高阳县| 连云港市| 保山市| 阳原县| 凤城市| 张家港市| 缙云县| 濉溪县| 塔城市| 墨玉县| 镇安县| 青神县| 平度市| 许昌市| 南岸区| 芜湖县| 双峰县| 武乡县| 宜章县| 收藏| 枣庄市| 梁河县| 济源市| 兴义市| 哈密市| 九寨沟县| 晋江市| 鄂伦春自治旗| 仙居县| 临夏市| 贵阳市| 唐海县| 定安县| 察雅县| 左贡县| 离岛区| 诏安县|