How can I retrieve the original message in a Telegram Bot reply?

I’m working on a Telegram Bot that must respond to user replies. Here’s what I’m trying to do:

User 1: What's the weather like?
User 2: (Replying to User 1) /forecast London

While my bot correctly receives the command and the city name, it doesn’t capture the original message content about the weather. The documentation suggests using reply_to_message, but my webhook logs don’t show it at all.

Below is a sample of the JSON I received:

{
  "update_id": 1234567,
  "message": {
    "message_id": 89,
    "from": {
      "id": 987654321,
      "first_name": "User 2",
      "username": "weather_fan"
    },
    "chat": {
      "id": -100123456789,
      "title": "Weather Chat",
      "type": "group"
    },
    "date": 1634567890,
    "text": "/forecast London",
    "entities": [
      {
        "type": "bot_command",
        "offset": 0,
        "length": 9
      }
    ]
  }
}

Am I overlooking something? I would appreciate any advice on how to access the original message.

hey mate, sounds like ur missing the reply_to_message field in ur webhook. make sure ur bot has the right permissions in the group. also, check if ur using the latest telegram Bot API version. they sometimes change stuff without telling us lol. good luck!

I’ve encountered this issue before, and it can be a bit tricky. One thing to check is whether you’ve enabled message_thread support in your bot settings. Without it, you might not receive the full context of replied messages.

Another approach that worked for me was using the getUpdates method instead of webhooks. It gives you more control over the data you receive and often includes the reply_to_message field.

If you’re set on using webhooks, you might need to modify your server-side code to parse the incoming data differently. Sometimes, the reply information is nested deeper in the JSON structure than expected.

Lastly, double-check your bot’s privacy settings. If it’s not receiving all messages in the group, it might miss the context of replies. Hope this helps!