claude-code - 💡(How to fix) Fix [Feature] Telegram plugin: include reply-to message context in channel notifications [1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#54933Fetched 2026-05-01 05:50:38
View on GitHub
Comments
1
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×2closed ×1commented ×1

Code Example

...(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
    ?? ctx.message.reply_to_message.caption
    ?? '',
} : {}),
RAW_BUFFERClick to expand / collapse

When a Telegram user replies to a specific message (long-press > Reply), the Bot API provides the full replied-to message via ctx.message.reply_to_message. The plugin currently ignores this — only the new message text is forwarded to Claude, with no indication of which message it references.

This means Claude has no way to disambiguate what the user is referring to when they reply to a specific earlier message. From Claude's perspective, "yes do that" or "fix the conflicts on that one" arrives with no link to the message that provides context. In a busy session with multiple interleaved topics, this leads to Claude misattributing the user's intent.

The plugin already passes message_id in the channel meta for the inbound message. The suggested fix is to also include the replied-to context when present:

In handleInbound (server.ts ~line 962), the notification meta could add:

...(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
    ?? ctx.message.reply_to_message.caption
    ?? '',
} : {}),

This would let Claude see which prior message the user is responding to — the same context a human would get from the Telegram UI.

The reply_to_text field is the key piece. Without it, Claude would need to maintain a mapping of message IDs to content, which it can't do reliably across context compactions. Including the text directly keeps the notification self-contained.

Note: reply_to_message.from could also be included to distinguish whether the user is replying to their own earlier message vs one of Claude's replies, but the text alone covers the main use case.

extent analysis

TL;DR

To fix the issue, include the replied-to message context in the notification meta by adding reply_to_message_id and reply_to_text fields when ctx.message.reply_to_message is present.

Guidance

  • Modify the handleInbound function in server.ts (~line 962) to include the replied-to message context in the notification meta.
  • Add the reply_to_message_id and reply_to_text fields to the notification meta when ctx.message.reply_to_message is present, as shown in the suggested fix.
  • Consider including the reply_to_message.from field to distinguish between user and Claude's replies, but prioritize including the reply_to_text field for self-contained notifications.
  • Verify that the fix works by checking if Claude can correctly disambiguate user intent when replying to specific messages.

Example

...(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
    ?? ctx.message.reply_to_message.caption
    ?? '',
} : {}),

Notes

This fix assumes that the ctx.message.reply_to_message object contains the necessary information about the replied-to message. If this object is missing or incomplete, additional debugging may be required.

Recommendation

Apply the suggested workaround by modifying the handleInbound function to include the replied-to message context in the notification meta, as this provides the necessary information for Claude to disambiguate user intent.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [Feature] Telegram plugin: include reply-to message context in channel notifications [1 comments, 1 participants]