Skip to content

feat: Telegram adapter missing slash command support #282

@jhezjkp

Description

@jhezjkp

Problem

The Telegram adapter (src/messaging/telegram.rs) does not support slash commands like /top, /help, etc. All messages, including those starting with /, are treated as regular conversational input.

Current behavior

All inbound Telegram messages are routed as plain conversation regardless of content. There is no mechanism to map a Telegram command (e.g. /ask) to a specific agent ID.

Expected behavior

Telegram should support slash commands similar to the Slack adapter, allowing operators to configure command → agent_id mappings in config.

Reference: Slack implementation

The Slack adapter (src/messaging/slack.rs) already has this feature:

  • Maintains a commands: Arc<HashMap<String, String>> map (command string → agent_id)
  • Accepts Vec<SlackCommandConfig> at construction time to populate the map
  • Has a dedicated handle_command_event handler that:
    • Validates workspace/channel permissions
    • Looks up the configured agent for the command
    • Enqueues an InboundMessage with slack_command and slack_command_agent_id metadata for downstream routing

Suggested approach

Mirror the Slack pattern for Telegram:

  1. Add a TelegramCommandConfig (or reuse a shared type) with command + agent_id fields
  2. Add a commands: Arc<HashMap<String, String>> field to TelegramAdapter
  3. In the inbound polling loop, detect messages whose text starts with / and look up a matching command entry
  4. If found, enqueue with the appropriate agent routing metadata; otherwise fall through to normal conversation handling

Environment

  • Adapter: src/messaging/telegram.rs
  • Compared against: src/messaging/slack.rs (lines 43–45, 378–521)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions