+ 3
How to send a message to Telegram channel using Telegram API (not Bot) using C# application?
I tried TLSharp library from github but it is not working.
3 Réponses
+ 3
How to implement something like telethon API for C# for Telegram API.
+ 2
string urlString = "https://api.telegram.org/bot{0}/sendMessage?chat_id={1}&text={2}";string apiToken = "my_bot_api_token";
string chatId = "@my_channel_name";
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
hope it be helpful.
0
thanks