My telegram bot receives messages sent by user to my bot in private chats but not receives messages sent by users in group chats. Any options/api for getting group chat mess
You can access all avaliable settings from all of your bots by sending /mybots
to Botfather
. Choose the bot, then Bot Settings and Group Privacy. If its disable (default), you can tap on Turn off.
Now its possible to receive the chat history using GetUpdates
. This can be done via HTTP API or the frameworks. For example, in C# (.NET Core) like this:
var bot = new TelegramBotClient(ApiToken);
var updates = bot.GetUpdatesAsync().Result;
foreach(var update in updates) {
Console.WriteLine($"{update.ChannelPost.Date} {update.ChannelPost.Text}");
}
But keep in mind that this feature has some kind of perfect forward secrecy implemented. So you only get messages that were send after group privacy is disabled. As a result, the GetUpdates
result is empty until some post was made.