Skip to content

Telegram: add notification mode to suppress intermediate push notifications #22771

@CalmProton

Description

@CalmProton

Problem

When using Hermes Agent through Telegram, the bot sends a push notification for every single message — tool calls, thinking/progress updates, streaming tokens, status messages, commentary. This results in dozens of notifications per turn, making the experience noisy and disruptive.

Telegram's Bot API has a built-in disable_notification parameter on sendMessage (and all other send methods) that allows sending messages silently — they still appear in the chat, but the user's device does not buzz/ding.

Proposed Solution

Add a configurable notifications mode for the Telegram platform adapter:

config.yaml:

display:
  platforms:
    telegram:
      notifications: important   # "all" (default) | "important"

Or via env var: HERMES_TELEGRAM_NOTIFICATIONS=important

Modes

Mode Behavior
all (default) Every message triggers a push notification (current behavior, backward compatible)
important Only final responses, approval requests, and slash confirmations trigger notifications. All intermediate messages (tool progress, streaming, status, commentary) are delivered silently via disable_notification=True.

Messages that become silent in important mode

  • Tool progress bubbles ("searching...", "executing code...")
  • Streaming previews / progressive edits
  • Status messages (context pressure, model fallback)
  • Commentary / interim assistant messages ("I'll inspect the repo...")
  • Auto-reset notices

Messages that still notify in important mode

  • Final response text (the agent's last message before waiting for user input)
  • Approval requests (dangerous command confirmations with Allow/Deny buttons)
  • Slash confirmations
  • Media attachments that are part of the final response

Technical approach

  • TelegramAdapter gains a _notifications_mode attribute and a _notification_kwargs(metadata) helper
  • All send methods (send, send_voice, send_image, send_document, send_video, send_animation, send_media_group) pass disable_notification=True in important mode unless overridden
  • send_exec_approval() and send_slash_confirm() never get silenced
  • The final response delivery in BasePlatformAdapter._process_message_background() sets metadata["notify"] = True on the cloned metadata dict, allowing the adapter to override silent mode
  • Zero overhead in all mode — _notification_kwargs returns {}
  • Zero impact on non-Telegram platforms

Testing

  • All 348 Telegram-related unit tests pass
  • Manual verification of _notification_kwargs() behavior for all metadata/None cases
  • Backward compatible: default mode all produces identical API calls

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/gatewayGateway runner, session dispatch, deliveryplatform/telegramTelegram bot adaptertype/featureNew feature or request

    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