skip to Main Content

I’m working with the Telegram Bot API and trying to reply to a message from another chat by specifying the message_id and chat_id in the reply_parameters parameter in the sendMessage method. Despite verifying that both message_id and chat_id are correct and valid, I keep encountering this error:

TelegramError: 400: Bad Request: message to be replied not found

What I Tried:

1. Verified the message_id and chat_id and both are correct.

2. Tested via Postman:

  • Endpoint:
https://api.telegram.org/bot<TOKEN>/sendMessage
  • Payload:
{
  "chat_id": 0, // Replace it with a real chat_id
  "text": "This is a reply to a message from another chat",
  "reply_parameters": {
    "message_id": 361,
    "chat_id": -1001005640892
  }
}
  • Response:
{
    "ok": false,
    "error_code": 400,
    "description": "Bad Request: message to be replied not found"
}

3. Checked Bot Permissions:

The bot has sufficient permissions in both chats:

  • The user has started the bot before, so it has permission to send messages to them.
  • The specified chat_id in the reply_parameters belongs to the Telegram’s official channel and it’s a public channel.

4. Checked Cross-Chat Restrictions:

This is not a business account, so cross-chat replies should be supported.

5. Tested both forwardMessage and copyMessage methods to send a message sent to the bot by a user (which was a reply to a message in another chat that I tried to specify in the reply_parameters before), without passing reply_parameters, and it worked!

  • How:

NOTE: Both User1 and User2 have started the bot before

  1. User1 sent a message (which was a reply to the message that I mentioned earlier) to the bot using "Reply in Another Chat" feature

  2. The bot used the forwardMessage and copyMessage methods to send it to User2, and both WORKED!


My Questions:

  1. Why is this error occurring even though the message_id and chat_id are correct?

  2. Is there an additional setup or restriction I might’ve missed?

  3. Could this be an issue with the Telegram Bot API itself?

2

Answers


  1. Chosen as BEST ANSWER

    The error occurred because my bot wasn't an admin in the channel specified in the reply_parameters. According to the Telegram Bots Documentation, all bots, regardless of settings, can only access messages from:

    1. Private chats: Only when a user initiates the chat by starting it.

    2. Groups / Supergroups:

    • Privacy Mode = Enabled:

      • Only messages explicitly addressed to it (e.g., mentioning the bot or using its commands)
    • Privacy Mode = Disabled:

      • All messages in the group, but this requires explicit permission from a group admin.

    NOTE: Privacy mode is enabled by default for all bots, except bots that were added to a group as admins. Read more

    3. Channels: Only where the bot is an admin.


  2. By default, bots can only access messages in chats with the bot (the bot is member of), so what happened here that the bot is not member of the chat_id in reply_parameters.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search