Why Ntfy?

Getting alerts from servers shouldn’t require Slack, PagerDuty, or email. Ntfy makes it dead simple:

  • Zero configurationcurl -d "message" ntfy.sh/topic sends a push notification.
  • Phone + Desktop — Apps for Android, iOS, and web browser.
  • Self-hostable — Run your own instance for privacy and control.
  • Integrates with everything — Uptime Kuma, Grafana, cron, shell scripts, CI/CD.

Prerequisites

  • Docker (for self-hosted) or use the free public instance at ntfy.sh.
  • The Ntfy app on your phone (Android or iOS).

Step 1: Deploy with Docker (Self-Hosted)

docker run -d \
  --restart=always \
  -p 2586:80 \
  -v /var/cache/ntfy:/var/cache/ntfy \
  --name ntfy \
  binwiederhier/ntfy serve \
  --cache-file /var/cache/ntfy/cache.db

Access at http://your-server:2586.

Or just use the free public instance at https://ntfy.sh — no setup required.


Step 2: Send Notifications

Basic Message

curl -d "Deployment to production complete ✅" http://your-server:2586/deployments

With Title, Priority, and Tags

curl \
  -H "Title: Backup Failed" \
  -H "Priority: urgent" \
  -H "Tags: warning,backup" \
  -d "MySQL backup on db-server failed at $(date)" \
  http://your-server:2586/server-alerts

Priority Levels

PriorityEffect
minNo sound, no vibration
lowNo sound
defaultNormal notification
highOverrides Do Not Disturb
urgentPersistent, loud alert

Step 3: Common Use Cases

Cron Job Alerts

# /etc/crontab
0 2 * * * root /usr/local/bin/backup.sh && curl -d "✅ Backup done" ntfy.sh/my-server || curl -H "Priority: high" -d "❌ Backup FAILED" ntfy.sh/my-server

CI/CD Pipeline Notifications

# GitHub Actions / Gitea Actions
- name: Notify on success
  if: success()
  run: curl -d "Build ${{ github.sha }} passed ✅" ntfy.sh/ci-builds

- name: Notify on failure
  if: failure()
  run: curl -H "Priority: high" -d "Build ${{ github.sha }} FAILED ❌" ntfy.sh/ci-builds

SSH Login Alerts

# /etc/profile.d/ntfy-login.sh
curl -d "SSH login: $(whoami)@$(hostname) from ${SSH_CLIENT%% *}" ntfy.sh/ssh-logins

Troubleshooting

ProblemSolution
Notifications not arriving on phoneEnsure the app is subscribed to the exact topic name; check phone battery optimization settings
”Unauthorized” errorEnable authentication on self-hosted Ntfy; verify credentials
Messages delayedCheck if phone is in battery saver mode; verify server connectivity
Topic “hijacked” on public instanceUse a long random topic name or self-host for sensitive alerts

Summary

  • Send notifications with a single curl command.
  • Use priority levels to control urgency (from min to urgent).
  • Integrate with cron, CI/CD, Uptime Kuma, Grafana, and any HTTP-capable tool.
  • Self-host for control, or use the free ntfy.sh public instance.