You have to use the @BotFather bot to set the Group Privacy off. This let the bot to access all the group messages.
By default, Group Privacy
is enabled
for bots. This setting has to be changed used the @BotFather bot >> Bot Settings >> Group Privacy >> Turn off
Please note that this change is not propagated automatically, so in case the bot is already in a group before turning off privacy mode, it will remain as it was before. To apply the changes, the bot should be removed and added again to the group(s).