Skip to content

Add support for message_thread_id across all Send-* functions #57

Open

Description

@koresent

Description

Currently, PoshGram does not support sending messages (or other media) to a specific forum topic (thread) in supergroups.
The Telegram Bot API provides the message_thread_id parameter in several methods (e.g., sendMessage, sendPhoto, sendDocument, sendVideo, etc.).
Without this parameter, bots cannot target a specific topic, which significantly limits their usefulness in forum-style supergroups.

Describe the solution you'd like

Add an optional parameter MessageThreadID (mapped to message_thread_id in the Telegram Bot API) across all relevant PoshGram functions (Send-TelegramTextMessage, Send-TelegramLocalPhoto, Send-TelegramLocalDocument, etc.).

  • When provided, the parameter should be included in the payload.
  • When omitted, the default behavior remains unchanged (messages go to the root chat).

Describe any alternatives you've considered

  • Manually modifying individual functions in the module to inject message_thread_id into the payload. This works but is not maintainable, since every update overwrites custom edits.
  • Sending messages only to the root chat without topic assignment, but this removes the ability to organize content into threads.

Additional context

Telegram Bot API reference: sendMessage and related methods.
Relevant field: message_thread_id – Unique identifier for the target message thread (topic) of the forum; for forum supergroups only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions