Get Reply Message from Telegram Bot API

11,922

Goto @BotFather, and turn off privacy mode

/setprivacy — Set which messages your bot will receive when added to a group. With privacy mode disabled, the bot will receive all messages.

You might need re-add your bot to group after set this.

Share:
11,922
Gideon Rosenthal
Author by

Gideon Rosenthal

Updated on June 08, 2022

Comments

  • Gideon Rosenthal
    Gideon Rosenthal almost 2 years

    I'm developing a Bot that I want users to call in a reply to a previous message. So you would reply to a message with the bot command.

    For Example
    User 1: Hello World
    User 2: (Reply to Hello World) /command test message

    Right now I am only able to grab the text sent directly in the command ("test message"), but not the first message ("Hello World"). According to their documentation, I should be able to get it from reply_to_message. However, all I'm seeing in my logs from the webhook is this.

    event: {
      body: {
        update_id: 5632431,
        message: {
          message_id: 43,
          from: {
            id: < my_user_id > ,
            first_name: 'User 2',
            username: 'user_2_username',
            language_code: 'en'
          },
          chat: {
            id: < chat_id > ,
            title: < chat_name > ,
            type: 'group',
            all_members_are_administrators: true
          },
          date: 1498342725,
          text: '/command test message',
          entities: [{
            type: 'bot_command',
            offset: 0,
            length: 5
          }]
        }
      }
    }

    Am I doing something wrong? Anyone have experience getting a reply message? Any help would be appreciated.

  • Wboy
    Wboy about 6 years
    This seems like a nuclear option when you're only interested in the reply portion though