Alexey Ryazhskikh
Alexey Ryazhskikh

Reputation: 2500

Is it possible for telegram bot to get messages from channel?

I added bot to channel as administrator but I have no messages in bot.on('message' callback. I have no problems with groups add bot privacy disabled. How to get upcoming channel messages?

const TelegramBot = require('node-telegram-bot-api');
let bot = new TelegramBot('xxxxxxxxxxxxxxxxxx', {polling: true});

bot.on('message', (msg) => {
    console.log(`${msg.from.username}:  ${msg.text} ${msg.location}`);
});

Upvotes: 4

Views: 3105

Answers (1)

91DarioDev
91DarioDev

Reputation: 1690

as you can see in the documentation the right attribute of update is "channel_post" and not "message"

Upvotes: 4

Related Questions