botstelegramnode-telegram-bot-api

How to use setMessageReaction(node-telegram-bot-api)?


Getting error ETELEGRAM:

400 Bad Request: message to react not found

I am using the node-telegram-bot API and trying to set a reaction to a message in the channel via the setMessageReaction method:

bot.setMessageReaction method('@channel_name', message_id, [
{type: 'emoji', emoji: 'πŸ‘' },
])

But I get the following error:

ETELEGRAM: 400 Bad Request: message to react not found

What could be the reason if the message id is correct?


Solution

  • The problem isn't the permissions, but the emoji needs to be passed this way.

    const reaction = [{ type: 'emoji', emoji: '🀬' }];
    
    bot.setMessageReaction(chatId, messageId, {reaction: JSON.stringify(reaction)})