Thomas
Thomas

Reputation: 12107

How can a telegram bot broadcast a message to active chats / users

We are building an internal bot to monitor / control our software. It is NOT exposed to the public and will be used by other team members, either directly (as a direct chat) or through a few channels depending which side of the software is on topic.

The bot should do two things:

When a message arrives, I can get the channel id and the user id; while the user id is kind of guaranteed to exist for while, what is the situation with the channel?

Can I store the channel id and broadcast messages to all channels the bot is involved in? what happens if a channel is closed? do channel ids have lifetimes?

I can't really find anything online about the best practice regarding this scenario.

Upvotes: 0

Views: 2583

Answers (1)

UnrivaledIr
UnrivaledIr

Reputation: 2106

I have doubt Understand what you want but it seems better know these things :

  • ID's are unique in Telegram and even in all others applications so they are lifetime
  • Channel ID , Groups ID , User ID have same behavior but their difference is on their integer. (User ID's are Positive but channels and groups are Negative. check example here)
  • Users can just send message in channels that they have admin permission in it right? Bots are same. so if your bot isn't admin anymore , the Telegram gives you error in response and you can check it and after facing that error delete that channel ID in your channels list.

I hope this information help you but if you have any other question feel free to leave a comment and I'll update the post and answer you immediately.

Upvotes: 3

Related Questions