Building a Notification System with Ntfy and n8n: Push Alerts for Everything
Create a self-hosted notification system using Ntfy for push delivery and n8n for workflow automation. Covers server monitoring alerts, deployment...
The Notification Problem
Modern teams are drowning in notifications from dozens of SaaS tools — Slack, email, PagerDuty, Datadog. Each costs money and adds complexity. What if you could consolidate all alerts into a single self-hosted system?
Workflow automation: triggers, conditions, and actions chain together to eliminate manual processes.
Ntfy is a lightweight HTTP-based pub-sub notification service. n8n is a workflow automation platform with 400+ integrations. Together, they create a powerful, self-hosted notification backbone.
Deploying Ntfy
# docker-compose.yml
services:
ntfy:
image: binwiederhier/ntfy:latest
container_name: ntfy
command: serve
volumes:
- ./ntfy/server.yml:/etc/ntfy/server.yml
- ntfy_cache:/var/cache/ntfy
- ntfy_data:/var/lib/ntfy
ports:
- "8093:80"
healthcheck:
test: ["CMD", "wget", "-q", "--tries=1", "http://127.0.0.1:80/v1/health", "-O", "-"]
interval: 30s
timeout: 5s
retries: 3
restart: unless-stopped
volumes:
ntfy_cache:
ntfy_data:
Ntfy Server Configuration
# ntfy/server.yml
base-url: "https://notify.example.com"
cache-file: "/var/cache/ntfy/cache.db"
auth-file: "/var/lib/ntfy/auth.db"
auth-default-access: "deny-all"
behind-proxy: true
keepalive-interval: "45s"
upstream-base-url: "https://ntfy.sh"
Create Users and Permissions
Get more insights on Tutorials
Join 2,000+ engineers who get our weekly deep-dives. No spam, unsubscribe anytime.
# Create admin user
docker exec -it ntfy ntfy user add --role=admin admin
# Create topics with access control
docker exec -it ntfy ntfy access admin 'ops-*' rw
docker exec -it ntfy ntfy access admin 'deploy-*' rw
Sending Notifications
Ntfy's API is beautifully simple — just HTTP POST:
# Simple notification
curl -d "Deployment to production completed successfully" \
https://notify.example.com/ops-deploys
# With title, priority, and tags
curl -H "Title: Disk Space Warning" \
-H "Priority: high" \
-H "Tags: warning,disk" \
-d "Server web1: /var is at 92% capacity" \
https://notify.example.com/ops-alerts
# With actions (clickable buttons)
curl -H "Title: PR Review Requested" \
-H "Actions: view, Open PR, https://git.example.com/pr/42" \
-d "New PR from @dev: Fix authentication timeout" \
https://notify.example.com/dev-prs
n8n Integration Workflows
A well-structured configuration file is the foundation of reproducible infrastructure.
Workflow 1: Server Monitoring Alerts
Create an n8n workflow with a Cron trigger running every 5 minutes. Add an SSH node that checks disk usage, an IF node checking if usage exceeds 85 percent, and an HTTP Request node that POSTs to your Ntfy topic with high priority.
The flow looks like: Cron Trigger -> SSH (check disk) -> IF (usage > 85) -> HTTP Request (POST to Ntfy)
Workflow 2: Deployment Notifications
Set up a Webhook trigger in n8n that receives deployment events from your CI/CD pipeline:
# Trigger from CI/CD
curl -X POST https://n8n.example.com/webhook/deploy-notify \
-H "Content-Type: application/json" \
-d '{"service": "api", "version": "2.3.1", "status": "success"}'
The n8n workflow receives this, formats it, and sends to Ntfy with appropriate priority and tags.
Workflow 3: Uptime Kuma Integration
When Uptime Kuma detects a service is down, it sends a webhook to n8n. The n8n workflow handles escalation logic — first alert is normal priority. If the service is still down after 5 minutes, send high priority. After 15 minutes, send urgent.
Mobile Setup
Install the Ntfy app on your phone (Android or iOS), subscribe to your topics, and get push notifications for everything — server alerts, deployments, CI/CD results, custom events.
Free Resource
Free Cloud Architecture Checklist
A 47-point checklist covering security, scalability, cost optimization, and disaster recovery for production cloud environments.
Bash Integration Scripts
#!/bin/bash
# notify.sh - Universal notification helper
NTFY_URL="https://notify.example.com"
NTFY_TOKEN="tk_your_token_here"
notify() {
local topic="\$1"
local title="\$2"
local message="\$3"
local priority="$4"
curl -s -H "Title: \$title" \
-H "Priority: \$priority" \
-H "Authorization: Bearer \$NTFY_TOKEN" \
-d "\$message" \
"\$NTFY_URL/\$topic"
}
# Usage examples
notify "ops-deploys" "Build Complete" "Frontend v2.3.1 deployed to production"
notify "ops-alerts" "High CPU" "web1: CPU at 95% for 10 minutes" "high"
Add to your deployment scripts:
# In your deploy.sh
docker compose pull && docker compose up -d
if [ \$? -eq 0 ]; then
notify "ops-deploys" "Deploy Success" "All services updated"
else
notify "ops-alerts" "Deploy FAILED" "Docker compose up failed" "urgent"
fi
Docker Compose brings up your entire stack with a single command.
Cost Comparison
| Solution | Monthly Cost | Self-Hosted |
|---|---|---|
| PagerDuty | 21+ per user | No |
| Opsgenie | 9+ per user | No |
| Slack Pro | 8.75 per user | No |
| Ntfy + n8n | 0 | Yes |
At TechSaaS, Ntfy handles all our operational notifications — from deployment alerts to backup verification to security events. Combined with n8n for workflow logic, we have a notification system that rivals PagerDuty at zero cost.
Want to set up self-hosted notifications? Contact [email protected].
Related Service
Cloud Solutions
Let our experts help you build the right technology strategy for your business.
Need help with tutorials?
TechSaaS provides expert consulting and managed services for cloud infrastructure, DevOps, and AI/ML operations.
We Will Build You a Demo Site — For Free
Like it? Pay us. Do not like it? Walk away, zero complaints. You will spend way less than hiring developers or any agency.
No spam. No contracts. Just a free demo.