We often use Telegram-Groups for notifications from our systems / scripts. In the last week, four of our bots stopped working. After a short check, I was able to identify the issue as "supergroup migrations".
What is a supergroup?
Telegram supergroups support up to 5.000 people in a group that are optimized for a large group of people.
- New members can see the entire message history when they join.
- Deleted messages will disappear for all members.
- Ordinary members can only delete their own messages.
- Supergroups are muted by default and send fewer joined/left notifications.
Do you need such a group for status notifications? No...
Get the new ChatID of the group
But, somehow, our groups were migrated to supergroups and with this, the ChatID was changed. When you send a message to a group using the old ChatID you will get the new ChatID:
To send a message, just issue this command: of course you need to insert your Bot-Data and ChatID
$ wget https://api.telegram.org/bot{YourBotID}:{YourBotSecret}/sendMessage?chat_id=-123456789&text=TestMessage
As result you will receive a JSON giving you the new ChatID
{"ok":false,"error_code":400,"description":"Bad Request: group chat was upgraded to a supergroup chat","parameters":{"migrate_to_chat_id":-100123456789}}
Simply update your scripts to this new ChatID and everything will be working again.