2

I have channel and I want to send automatic messages to this channel using C# and telegram API.

What should I do?

Alex
  • 33
  • 1
  • 3

1 Answers1

2

First create a bot and add that as an administrator to your channel

help:

Adding Bot as administrator to channel

Creating Bot

then use the following code to send message to your group

WebRequest req = WebRequest.Create("https://api.telegram.org/bot" + yourToken + "/sendMessage?chat_id=" + channel_id + "&text=" + message);
req.UseDefaultCredentials = true;

var result = req.GetResponse();
req.Abort();

yourToken is your bot's token, channel_id is your channel's ID and message is a string that you want to send to your channel

Community
  • 1
  • 1
Hadi Barak
  • 480
  • 1
  • 4
  • 17