E
E
estry2018-02-26 22:28:39
C++ / C#
estry, 2018-02-26 22:28:39

How to send a message to a Telegram channel using the Telegram.Bot bot and C# library?

Hello! Who will tell you how to send posts to the Telegram channel using this bible . I created the channel, I created the bot, I made it the admin of the channel. I write the code:
string strChat = "@namechannel";
var test = new Telegram.Bot.TelegramBotClient("535214223:AAEKPwGgq-TSqNF9xxxNQcYkuTePDvMfkB4");
var GetMe = test.GetMeAsync();
var SendMessage = test.SendTextMessageAsync(strChat, "hi");
As a result, the chat is empty :( Tell me please, maybe I'm missing something.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jaka, 2018-02-27
@jaka

The same thing happens to me, the last time it worked a week ago, now it has stopped working. It turns out I forgot to make the bot the admin of the channel, I did, but it still didn’t help. I'll figure it out and write back. Try to make the bot an admin, if not done, it can help ..
----------------------------------
UPD
In general, I found solution (may be temporary).
string strChat = "@namechannel"; change to string strChat = "channel id";
channel id can be obtained:
https://api.telegram.org/bot/[email protected]
Get response: {"ok":true,"result":{"message_id":129,"chat": {"id":-10...03

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question