Skip to content

feat(glyph): ntfy + Slack notification relay#442

Merged
stackptr merged 11 commits intomainfrom
glyph/feat-ntfy-slack
Apr 13, 2026
Merged

feat(glyph): ntfy + Slack notification relay#442
stackptr merged 11 commits intomainfrom
glyph/feat-ntfy-slack

Conversation

@stackptr
Copy link
Copy Markdown
Owner

@stackptr stackptr commented Apr 13, 2026

Summary

Replaces Pushover with a self-hosted ntfy notification bus that forwards to Slack via a bot, providing a unified messaging layer for all glyph services.

Infrastructure

  • ntfy-sh runs on 127.0.0.1:2586 as an internal pub/sub bus; services POST to it without touching Slack directly
  • ntfy-slack-relay systemd service subscribes to the notifications topic via ntfy's HTTP JSON stream and forwards each message to #updates via chat.postMessage
  • Slack bot token stored as an agenix secret, accessible only to the ntfy-sh user
  • set -o pipefail ensures curl failures propagate as non-zero so systemd restarts the relay on connection loss

Transmission integration

  • script-torrent-done now POSTs to ntfy instead of Pushover
  • Message format: Torrent Name finished downloading. View torrents
  • Sets Title: Transmission and Tags: transmissionic headers; the relay maps these to the Slack username and icon_emoji fields respectively
  • Removed Pushover age secrets (pushover-app-token, pushover-user-token)

Adding future services

Any service on glyph can send a Slack notification with:

curl -s \
  -H "Title: ServiceName" \
  -H "Tags: emoji_name" \
  -d "message text" \
  http://127.0.0.1:2586/notifications

Test plan

  • Deploy to glyph and confirm ntfy-sh and ntfy-slack-relay are both active (running)
  • Verify subscribers=1 appears in journalctl -u ntfy-sh.service
  • Send a test notification: curl -H "Title: Test" -H "Tags: white_check_mark" -d "hello" http://127.0.0.1:2586/notifications
  • Confirm message appears in #updates with correct username and icon
  • Complete a torrent download and confirm notification arrives with bold name and View torrents link

🤖 Generated with Claude Code

stackptr and others added 8 commits April 12, 2026 21:21
- Add ntfy-sh service (localhost:2586) as a unified notification bus
- Add ntfy-slack-relay systemd service that subscribes to the homelab
  topic and forwards to Slack via chat.postMessage; sender identity
  driven by NTFY_TITLE header so each service appears distinctly
- Migrate transmission torrent-done script from Pushover to ntfy POST
- Add slack-bot-token agenix secret; remove pushover-{app,user}-token

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ntfy subscribe takes the server as part of the topic URL,
not a separate --url flag.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ntfy subscribe executes commands via sh internally, which is not in
the service PATH. Replace with a direct curl subscription to the
/topic/json SSE endpoint, parsing each event with jq and forwarding
to Slack ourselves.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tart

Without pipefail, curl | while always exits 0 (the while loop's exit
code), so systemd never restarts the relay on connection failure.
With pipefail, a curl failure propagates as non-zero, triggering
Restart=on-failure.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@stackptr stackptr marked this pull request as ready for review April 13, 2026 22:18
stackptr and others added 3 commits April 13, 2026 15:51
…fy tags

Senders set a Tags header on their ntfy POST; the relay extracts the
first tag and passes it as icon_emoji to chat.postMessage. Transmission
uses :transmissionic:.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tags were never parsed from the ntfy JSON event, so NTFY_TAGS was
always empty and icon_emoji resolved to "::" causing a generic avatar.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@stackptr stackptr changed the title feat(glyph): add ntfy + Slack notification relay, migrate from Pushover feat(glyph): ntfy + Slack notification relay Apr 13, 2026
@stackptr stackptr enabled auto-merge (squash) April 13, 2026 23:21
@stackptr stackptr disabled auto-merge April 13, 2026 23:22
@stackptr stackptr merged commit 7e49a49 into main Apr 13, 2026
5 checks passed
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