skip to Main Content

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?

2

Answers


  1. Your bot needs to have the necessary permissions to add reactions in the target chat.

    const TelegramBot = require('node-telegram-bot-api');
    
    const token = 'YOUR_BOT_TOKEN';
    const bot = new TelegramBot(token, { polling: true });
    
    const chatId = 123456789;
    const messageId = 123; 
    
    const reaction = [{ type: 'emoji', emoji: '👍' }]; 
    
    bot.setMessageReaction(chatId, messageId, reaction)
      .then(() => {
        console.log('Reaction added successfully!');
      })
      .catch(error => {
        console.error('Error adding reaction:', error);
      });
    
    Login or Signup to reply.
  2. 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)})
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search