feat(telegram): expose reply/quote context in <channel> meta

Author: ArtemShabanCreated Jun 14, 2026Updated Sep 17, 2026

Feature request

When a user replies to (or quotes) an earlier message in Telegram, the <channel> notification meta currently drops that context. It carries image_path and attachment_*, but nothing about the replied‑to message — so the assistant can't tell which message the user is responding to, and can't see a partial‑text quote.

The Bot API already exposes this: message.reply_to_message, and (since Bot API 7.0) message.quote. The plugin even reads reply_to_message today, but only to detect "replied to the bot = implicit mention" (server.ts ~L314) — the context is otherwise discarded.

Proposal

In handleInbound, surface reply context into the channel meta:

  • reply_to_message_id — id of the replied‑to message
  • reply_to_text — its text/caption snippet
  • reply_to_user — its author
  • reply_to_quote — the partial quote, when the user selected one

…and extend the channel instructions so the assistant uses these as context. The user‑controlled snippets go through the existing safeName() sanitizer + a 300‑char truncation — the same model already applied to attachment_name/file_name, so there's no new threat surface.

Reference implementation

I put together a complete, working diff (no new dependencies, bun build passes). I initially opened it as #2786 before realizing this repo only merges PRs from Anthropic team members, so I'm filing it as a feature request instead — the diff there is ready to use or adapt.

Why it matters

Replying to a specific earlier message is one of the most common Telegram interactions. Without this, the assistant loses the thread whenever the user replies to something a few messages back — it just sees the new text with no idea what it refers to.

Source: anthropics/claude-plugins-official