Skip to content

bug(telegram): message_thread_id stripped for DM topics since 19b8416a8 #17977

@timbrinded

Description

@timbrinded

Bug

buildTelegramThreadParams() unconditionally returns undefined for scope: "dm", stripping message_thread_id from all DM sends. This causes replies to land in the wrong topic (or outside topics entirely) when a user has Telegram DM topics enabled.

Introduced in

Commit 19b8416a8 ("fix: unify telegram thread handling", Feb 2 2026) added the DM scope to buildTelegramThreadParams with a blanket return undefined:

// Never send thread_id for DMs (threads don't exist in private chats)
if (thread.scope === "dm") {
  return undefined;
}

This was incorrect — Telegram Bot API 9.3 (Dec 31 2025) added Topics in private chats, which supports message_thread_id in DM sends.

Impact

Any bot with DM topics enabled (via @Botfather) will have replies misrouted. The existing withTelegramThreadFallback retry handles the opposite case (thread ID rejected by API), but cannot help when the thread ID is stripped before the request is even made.

Fix

PR #17952 — pass through positive thread IDs for DM scope, filter only invalid values (≤ 0).

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