Skip to content

Telegram: legacy-Markdown sanitizer is obsoleted by @chat-adapter/telegram@4.30.0 (native MarkdownV2) #2767

@chiptoe-svg

Description

@chiptoe-svg

Summary

On the channels branch, src/channels/telegram-markdown-sanitize.ts works around the Telegram adapter hardcoding legacy parse_mode=Markdown. As of @chat-adapter/telegram@4.30.0 (published 2026-06-02) that's fixed upstream: the adapter now resolves parse_mode=MarkdownV2 and ships a context-aware converter (MARKDOWNV2_SPECIAL_CHARS / CODE_BLOCK_SPECIAL_CHARS / LINK_URL_SPECIAL_CHARS). The sanitizer's own header even names the pending fix (vercel/chat#367). It's now not just unnecessary but harmful — it mangles markdown (flattens lists, strips formatting on delimiter imbalance) before the adapter's correct converter runs.

Minimal fix

Bump @chat-adapter/telegram 4.26.0 → 4.30.0, delete telegram-markdown-sanitize.ts (+ test), and drop the transformOutboundText: sanitizeTelegramLegacyMarkdown line in telegram.ts.

Why I'm filing an issue, not a PR

The bridge's chat must move to 4.30.0 in lockstep, which bumps the whole vercel @chat-adapter/* suite — but four third-party adapters on this branch (@beeper/chat-adapter-matrix, @bitbasti/chat-adapter-webex, chat-adapter-imessage, @resend/chat-sdk-adapter) pin an older chat and don't move with it, splitting chat versions (the same skew that breaks a single adapter's ChatInstance typing). Resolving that cleanly is a coordinated-suite-bump decision you're better placed to make than a drive-by PR.

Verified

In a Telegram-only install I bumped chat + @chat-adapter/telegram to 4.30.0 and removed the sanitizer: MarkdownV2 renders correctly end-to-end (bold/italic/strike/code/blockquote/links, tables as aligned monospace, button cards) with zero can't parse entities errors.

Happy to PR the Telegram-side change if you advise on how you'd like to handle the suite / third-party-adapter versioning.

🤖 Filed with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions