Tracking Telegram bot messages in other channels and chats Node.js

Good afternoon, everyone. I am writing my first Telegram bot on Node.js. The task was set as follows: to count the number of all messages from each chat user. Then display the top most active users.

At the moment, I only count messages in a private chat with the bot itself. I added my bot to the chat with my friends.

I listen to messages using:

bot.on('message', (msg) => {
// код
};

This method does not work in a chat with friends. Only with a private chat with yourself a bot.

Access to messages via BotFather enabled.

How to solve this problem?

Thank you in advance for your help!

Author: Yana, 2020-04-13