Skip to content

feat(ntfy): add ntfy platform adapter#30625

Closed
sprmn24 wants to merge 1 commit into
NousResearch:mainfrom
sprmn24:feat/ntfy-platform-v2
Closed

feat(ntfy): add ntfy platform adapter#30625
sprmn24 wants to merge 1 commit into
NousResearch:mainfrom
sprmn24:feat/ntfy-platform-v2

Conversation

@sprmn24

@sprmn24 sprmn24 commented May 22, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds full support for ntfy as a messaging platform. ntfy is a lightweight, open-source push notification service that works with ntfy.sh or any self-hosted server.

Reopened from #4043 with all reviewer feedback addressed.

Type of Change

  • New feature (non-breaking change which adds functionality)

Changes Made

  • gateway/platforms/ntfy.py — platform adapter with HTTP streaming subscription, exponential backoff reconnection, message deduplication, Bearer/Basic auth support
  • gateway/config.py — NTFY platform enum entry and env var loading (NTFY_TOPIC, NTFY_SERVER_URL, NTFY_TOKEN, NTFY_PUBLISH_TOPIC, NTFY_MARKDOWN)
  • gateway/run.py — adapter factory and authorization maps
  • cron/scheduler.py — ntfy delivery in platform map
  • tools/send_message_tool.py — ntfy routing and _send_ntfy()
  • toolsets.py — hermes-ntfy toolset and gateway composite
  • hermes_cli/status.py — ntfy status display
  • agent/prompt_builder.py — ntfy platform hint
  • gateway/channel_directory.py — session-based channel discovery
  • tests/gateway/test_ntfy.py — 81 unit tests

Reviewer Feedback Addressed (from #4043)

@TheophileDiot:

  • Identity spoofing — removed title field as user identity source. ntfy is now treated as a single trusted channel; user_id is always the topic name. Added test_unknown_publisher_cannot_impersonate_allowed_user test.
  • Stale comment — fixed poll=true comment to poll=false
  • 401/404 infinite reconnect — added _FatalStreamError exception; 401/404 responses stop the reconnect loop instead of retrying every 60s
  • Backoff reset — backoff index resets to 0 when a stream stays alive for ≥60s
  • Message truncation — added logger.warning() when message exceeds 4096 char limit
  • Config load overheadcheck_ntfy_requirements() now reads NTFY_TOPIC env var directly instead of calling load_gateway_config() on every pre-check

@gerrydoro:

  • Markdown configurable — set markdown: true under extra: in config.yaml or NTFY_MARKDOWN=true env var; adapter sends X-Markdown: true header. Defaults to false.

How to Test

python3 -m pytest tests/gateway/test_ntfy.py -v

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix
  • I've tested on my platform: Ubuntu 24.04 (WSL2)

Documentation & Housekeeping

  • No documentation changes needed
  • Cross-platform considered — no platform-specific impact

@sprmn24 sprmn24 mentioned this pull request May 22, 2026
4 tasks
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery platform/webhook Webhook / API server labels May 22, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Superseded by #30867, which reshapes this adapter into a platform plugin under plugins/platforms/ntfy/ with zero core file edits.

@teknium1

Copy link
Copy Markdown
Contributor

Merged via #30867 — your adapter, security fixes, and original test coverage are all preserved via cherry-pick with your authorship intact on commit 16cc77c.

We reshaped the integration into a platform plugin under plugins/platforms/ntfy/ instead of editing the 8 core files the original PR touched (new platforms now go through gateway/platform_registry, like IRC/SimpleX/LINE/Teams). Followup commits added fatal-error propagation for 401/404, token-whitespace hygiene, shared auth/truncation helpers between adapter and standalone-send, plus full docs (messaging guide, env-var reference, sidebar entry).

Thanks for the clean adapter design — the identity-spoofing fix and the 401/404 reconnect-loop halt were exactly right.

#30867

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/webhook Webhook / API server type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants