+ 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.

10th Jun 2018, 4:34 AM
Anil Khatri
Anil Khatri - avatar
3 Réponses
+ 3
How to implement something like telethon API for C# for Telegram API.
12th Jun 2018, 1:36 AM
Anil Khatri
Anil Khatri - avatar
+ 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.
11th Jun 2018, 6:57 PM
Majid Rahimpour
Majid Rahimpour - avatar
0
thanks
16th Sep 2018, 11:50 AM
‎ربيع عزالدين الشميري‎
‎ربيع عزالدين الشميري‎ - avatar