1

I am using the python-telegram-bot package to develop a Telegram bot.

I was wondering if it's possible to access the details of a message that has been replied to from another chat?

Broader explanation:

When a user in a group click on a someone else's message and choose reply in another chat, and goes to a bot and writes some text and sends it to the bot, is it possible to track the original message and know details like id of group/supergroup, id of original user, message id of original message and so on?

I tried: update.effective_message.reply_to_message and update.effective_message.forward_origin. Both seem to return None.

0stone0
45.5k6 gold badges54 silver badges82 bronze badges
asked Jul 14, 2025 at 19:38

1 Answer 1

0

Yes, if the bot is an admin in the group, he will receive a regular message update that looks like the one below.

The external_reply hold the information you're looking for, the original replied message.

Where as the quote fields hold the part the users actually replies to, this can be part of the original message.


Regarding the Python Telegram Bot Library, there seems to be an ExternalReplyInfo available in telegram.Message.external_reply:

Information about the message that is being replied to, which may come from another chat or forum topic.


Raw getUpdates json to show the actual fields:

{
 "ok": true,
 "result": [
 {
 "update_id": 000000,
 "message": {
 "message_id": 81,
 "from": {
 "id": 000000,
 "is_bot": false,
 "first_name": "x",
 "username": "xx",
 "language_code": "en"
 },
 "chat": {
 "id": 000000,
 "title": "Test Group",
 "type": "supergroup"
 },
 "date": 1752579014,
 "external_reply": {
 "origin": {
 "type": "user",
 "sender_user": {
 "id": 000000,
 "is_bot": false,
 "first_name": "xxxx",
 "username": "xxxxxxxx",
 "language_code": "en"
 },
 "date": 1752490674
 }
 },
 "quote": {
 "text": "HERE ORIGINAL MESSAGE",
 "position": 0
 },
 "text": "HERE REPLIED MESSAGE"
 }
 }
 ]
}
answered Jul 15, 2025 at 11:32
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.