Category >
ASP.NET
|| Published on :
Thursday, October 10, 2019 || Views:
4720
||
Sending Message Telegram through ASP.NET C#
Introduction
Here Pawan Kumar will explain how to Sending Message Telegram through ASP.NET C#
Description
I will explain How to Sending Message Telegram through ASP.NET C#
So follow the steps to learn Sending Message Telegram through ASP.NET C#
string urlString = "https://api.telegram.org/bot{0}/sendMessage?chat_id={1}&text={2}"; string apiToken = "INSERT YOUR BOT TOKEN HERE";
string chatId = "INSERT YOUR CHAT ID";
string text = "Hello world!"; urlString = String.Format(urlString, apiToken, chatId, text); WebRequest request = WebRequest.Create(urlString); Stream rs = request.GetResponse().GetResponseStream(); StreamReader reader = new StreamReader(rs); string line = ""; StringBuilder sb = new StringBuilder();
while (line != null)
{
line = reader.ReadLine();
if (line != null)
sb.Append(line);
}
string response = sb.ToString();
// Do what you want with response
Conclusion:
So, In this tutorial we have learned, Sending Message Telegram through ASP.NET C#