Sending Message Telegram through ASP.NET C#

  ASP.NET   Thursday, October 10, 2019   84 | No Comments Yet!!! | No Download | No Demo | Pawan kumar
 Tags: Sending Message Telegram through ASP.NET C# 


Introduction

Here Pawan Kumar will explain how to Sending Message Telegram through ASP.NET C#

Description

In previous post I have explained ASP.NET : Source Code to ASP.NET : Source Code to Get GridView CheckBox Selected Rows jQuery, Check whether CheckBox is checked or not in ASP.Net using C#, Display TextBox when CheckBox is checked in ASP.Net using C#, How to display values only upto 2 decimal places, Simple way to convert datarow array to datatable, Show Loading Progress Indicator using GIF Image when UpdatePanel is updating in ASPNet.aspx, and many more articles.

Now 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#