2.0 KiB
2.0 KiB
homey/ntfy homey/ntfy
Self-hosted ntfy push notification server at https://ntfy.zakobar.com. Native NixOS service (not a container), port 2586. auth-default-access = deny-all — all clients need a token or password. Bypasses Authelia (ntfy enforces its own auth so the mobile app works without SSO). Topic for alerts: alerts.
Sending Notifications from CLI
Token stored in pass at zakobar-homecenter/ntfy-token.
# Basic
curl -H "Authorization: Bearer $(pass zakobar-homecenter/ntfy-token)" \
-d "your message" \
https://ntfy.zakobar.com/alerts
# With metadata
curl -H "Authorization: Bearer $(pass zakobar-homecenter/ntfy-token)" \
-H "Title: Backup complete" \
-H "Priority: default" \
-H "Tags: white_check_mark" \
-d "restic finished successfully" \
https://ntfy.zakobar.com/alerts
Priority values: min, low, default, high, urgent.
Tags are emoji shortcodes (e.g. warning, rotating_light, white_check_mark).
Token Management
Generating / rotating a token:
Two gotchas with ntfy token add:
- Output goes to stderr — must redirect with
2>&1or the pipe gets nothing. - No global
--configflag — useNTFY_AUTH_FILEenv var instead. pass insert -eprompts from/dev/tty, not stdin — use-m(multiline) for piping.
ssh admin@192.168.1.100 'sudo NTFY_AUTH_FILE=/mnt/data/ntfy/auth.db ntfy token add admin 2>&1' \
| awk '{print $2}' \
| pass insert -m -f zakobar-homecenter/ntfy-token
Listing / removing tokens (e.g. to clean up leaked tokens):
ssh admin@192.168.1.100 'sudo NTFY_AUTH_FILE=/mnt/data/ntfy/auth.db ntfy token list admin'
ssh admin@192.168.1.100 'sudo NTFY_AUTH_FILE=/mnt/data/ntfy/auth.db ntfy token remove admin tk_xxxx'