微信服務(wù)號(hào)推送模板消息接口
微信服務(wù)號(hào)現(xiàn)在用的比較火,用戶可以通過微信號(hào)訂閱信息,有時(shí)候會(huì)用到模板消息。下面貼上代碼,有注釋寫的很詳細(xì)。在此@access_token 請(qǐng)調(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", "請(qǐng)關(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); }
以上就是本文針對(duì)微信服務(wù)號(hào)推送模板消息接口的全部?jī)?nèi)容,希望對(duì)大家有所幫助。
- php版微信開發(fā)之接收消息,自動(dòng)判斷及回復(fù)相應(yīng)消息的方法
- 微信小程序-消息提示框?qū)嵗?/a>
- 微信小程序-詳解微信登陸、微信支付、模板消息
- 微信公眾號(hào)開發(fā)之文本消息自動(dòng)回復(fù)php代碼
- 微信公眾號(hào)開發(fā)之語(yǔ)音消息識(shí)別php代碼
- Java開發(fā)微信公眾號(hào)接收和被動(dòng)回復(fù)普通消息
- php實(shí)現(xiàn)微信公眾號(hào)主動(dòng)推送消息
- 基于python實(shí)現(xiàn)微信模板消息
- asp.net開發(fā)微信公眾平臺(tái)之獲取用戶消息并處理
- php實(shí)現(xiàn)發(fā)送微信模板消息的方法
- C#微信開發(fā)之接收 / 返回文本消息
相關(guān)文章
WPF+ASP.NET SignalR實(shí)現(xiàn)動(dòng)態(tài)折線圖的繪制
這篇文章將以一個(gè)簡(jiǎn)單的動(dòng)態(tài)折線圖示例,簡(jiǎn)述如何通過ASP.NET SignalR實(shí)現(xiàn)后臺(tái)通知功能,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以了解一下2023-01-01UGUI ScrollRect滑動(dòng)定位優(yōu)化詳解
這篇文章主要為大家詳細(xì)介紹了UGUI ScrollRect滑動(dòng)定位優(yōu)化,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-04-04淺談C# 非模式窗體show()和模式窗體showdialog()的區(qū)別
下面小編就為大家?guī)硪黄獪\談C# 非模式窗體show()和模式窗體showdialog()的區(qū)別。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2016-07-07C#實(shí)現(xiàn)IDisposable接口釋放非托管資源
這篇文章主要為大家介紹了C#實(shí)現(xiàn)IDisposable接口釋放非托管資源,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-05-05