Telegram plugin: include reply_to_message_id and reply_to_text in inbound notification meta
Problem
When a Telegram user swipes to reply to a specific bot message, the reply_to_message context from the Bot API is available on the incoming update (ctx.message.reply_to_message) but is not forwarded in the channel notification meta. Claude only sees the new message text with no indication of which message it's replying to.
This makes conversational threading impossible — the agent can't tell if the user is replying to a question, referencing a previous result, or starting a new topic.
Current behavior
Inbound notification meta (server.ts:929):
<channel source="telegram" chat_id="123" message_id="456" user="alice" ts="...">
Desired behavior
When the inbound message is a reply, include the replied-to context:
<channel source="telegram" chat_id="123" message_id="456" user="alice" ts="..."
reply_to_message_id="400" reply_to_text="Here are the books I found...">
Suggested change
In external_plugins/telegram/server.ts around line 929, add to the meta object:
...(ctx.message?.reply_to_message ? {
reply_to_message_id: String(ctx.message.reply_to_message.message_id),
reply_to_text: (ctx.message.reply_to_message.text ?? '').slice(0, 200),
} : {}),
Truncating reply_to_text to 200 chars keeps the payload small while giving the agent enough context to understand what the user is referencing.
Use case
Agents that operate primarily via Telegram (librarians, assistants) frequently receive replies like "yes, that one" or "add it" — without knowing what "that" or "it" refers to, the agent must ask the user to repeat context, which is frustrating on mobile.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗