Skip to content

Feature: Support Telegram Topics/Forum threads (message_thread_id routing) #6597

@Grahamovernightly

Description

@Grahamovernightly

Feature: Support Telegram Topics/Forum threads in DMs and Groups

Problem

When a Telegram bot has Topics enabled (via BotFather), messages from topic threads don't include message_thread_id in the agent's message envelope. This means:

  • Agent can't tell which topic a message came from
  • Agent can't route replies back to the correct topic (they land in General)

Current behavior

  • Inbound messages show only message_id, no thread context
  • message tool accepts threadId param but agent has no way to know what value to use

Expected behavior

  1. Inbound envelope should include threadId or message_thread_id when present
  2. Replies should auto-target the originating thread (like replyToMode does for message replies)

Context

  • Works for both DM-with-Topics and Group Forums
  • BotFather setting: "Topics in Groups" / bot added to forum-enabled group or DM
  • Telegram API provides message_thread_id in updates

Suggested implementation

  1. Parse message_thread_id from Telegram Update
  2. Add to envelope metadata (e.g., [threadId: 123])
  3. Store in session context for reply routing
  4. Use for outbound sendMessage calls automatically

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions