Skip to content

feat(gateway): add Telegram notification mode to suppress intermediate push notifications#22772

Closed
CalmProton wants to merge 1 commit into
NousResearch:mainfrom
CalmProton:feat/telegram-notification-mode
Closed

feat(gateway): add Telegram notification mode to suppress intermediate push notifications#22772
CalmProton wants to merge 1 commit into
NousResearch:mainfrom
CalmProton:feat/telegram-notification-mode

Conversation

@CalmProton

Copy link
Copy Markdown
Contributor

Summary

  • Adds a configurable notification mode for Telegram that suppresses push notifications for intermediate messages (tool calls, streaming, status updates) while still notifying for approvals, confirmations, and the final response.
  • Zero overhead in default mode ("all"), zero impact on non-Telegram platforms.

Problem

When using Hermes Agent through Telegram, every message — tool calls, thinking updates, streaming previews, commentary — triggers a push notification. The user's phone buzzes dozens of times per turn.

Telegram's Bot API has disable_notification on all send methods, which delivers messages silently (visible in chat but no device buzz). This PR uses that parameter.

Solution

New config option:

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

Or env var: HERMES_TELEGRAM_NOTIFICATIONS=important

Mode Behavior
all Every message notifies (existing behavior, default)
important Only final responses, approvals, and slash confirmations notify

What gets silenced in important mode

  • Tool progress bubbles
  • Streaming previews / edits
  • Status messages
  • Commentary / interim assistant messages
  • Auto-reset notices

What still notifies in important mode

  • Final response text
  • Approval requests (dangerous command confirmations)
  • Slash confirmations
  • Media attachments part of the final response

Technical details

  • TelegramAdapter gains _notifications_mode attribute and _notification_kwargs(metadata) helper
  • All 8 send methods (send, send_voice, send_image_file, send_document, send_video, send_image, send_animation, send_multiple_images) pass disable_notification=True when silenced
  • send_exec_approval() and send_slash_confirm() intentionally not modified — always notify
  • Final response detected in BasePlatformAdapter._process_message_background() via metadata["notify"]=True on a cloned metadata dict (avoids mutating the typing-indicator task's reference)
  • Config loaded in GatewayRunner._create_adapter(), gated to Platform.TELEGRAM only

Testing

  • All 348 Telegram and base adapter unit tests pass
  • Default "all" mode produces identical API calls — backward compatible
  • getattr fallback handles tests that bypass __init__ via object.__new__
  • None metadata handled: _notification_kwargs(None) returns {} in all mode

Files changed

File Change
gateway/platforms/telegram.py +23 lines: _notifications_mode attr, _notification_kwargs() helper, wired into all send methods
gateway/platforms/base.py +8 lines: clone metadata + set notify=True before final response delivery
gateway/run.py +15 lines: load config from config.yaml / env var, set on adapter
tests/gateway/test_base_topic_sessions.py +1 line: updated assertion for new metadata key

Closes #22771

…e push notifications

Add a configurable notifications mode for the Telegram platform adapter
that controls which messages trigger push notifications.

- display.platforms.telegram.notifications: "all" (default) | "important"
- HERMES_TELEGRAM_NOTIFICATIONS env var override
- In "important" mode, all sends use disable_notification=True except:
  - Approvals (send_exec_approval) and slash confirmations
  - Final response messages (metadata["notify"]=True)
- Zero overhead in default "all" mode
- Zero impact on non-Telegram platforms

Closes NousResearch#22771
@teknium1

teknium1 commented May 9, 2026

Copy link
Copy Markdown
Contributor

Merged via salvage PR #22793. salvage cherry-picked your commit; default flipped to 'important' on top per maintainer feedback (per-tool-call notifications were too noisy as the default). Thanks for the contribution!

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

Labels

comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have platform/telegram Telegram bot adapter type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Telegram: add notification mode to suppress intermediate push notifications

3 participants