Skip to content

feat(telegram): add topic group trigger overrides#2779

Open
bogdanovich wants to merge 1 commit intosipeed:mainfrom
bogdanovich:feat/telegram-topic-group-trigger
Open

feat(telegram): add topic group trigger overrides#2779
bogdanovich wants to merge 1 commit intosipeed:mainfrom
bogdanovich:feat/telegram-topic-group-trigger

Conversation

@bogdanovich
Copy link
Copy Markdown
Contributor

Summary

Adds per-topic group_trigger overrides for Telegram forum topics.

This lets a bot stay conservative in a Telegram supergroup by default, for example mention_only: true, while being active by default in one dedicated forum topic:

{
  "channel_list": {
    "telegram": {
      "group_trigger": {
        "mention_only": true,
        "topics": {
          "1771": { "mention_only": false }
        }
      }
    }
  }
}

Why this is needed

Telegram supergroups often use forum topics as separate sub-channels. A bot owner may want the bot to be mention-only in most topics to avoid interrupting normal group conversation, but fully active in a dedicated topic where users expect the bot to answer every message.

Doing this in the prompt is unreliable because the message has already reached the agent. The right layer is the channel trigger filter, before the inbound message is published to the agent bus.

Design

  • Extends existing group_trigger with optional topics map.
  • Keeps the trigger logic in BaseChannel, so Telegram does not duplicate mention/prefix filtering.
  • Telegram passes message_thread_id as the topic ID only for forum chats (is_forum=true), matching the existing session isolation behavior.
  • Topic entries replace the channel-level group_trigger for that topic.

The replacement semantics are intentional. Current config uses plain bools, so a partial merge cannot distinguish an omitted mention_only from an explicit mention_only: false. A topic entry such as { "mention_only": false } should be an explicit permissive override.

Testing

  • go test ./pkg/channels ./pkg/channels/telegram ./pkg/config

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant