Appearance
Generic Integration
Any system that can make an HTTP POST request can send notifications to Notifiq.
Minimal example
bash
curl -X POST https://notify.yourdomain.com/api/notify \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"title": "Something happened", "level": "warning", "message": "Something really happened here"}'Shell helper function
Add to your scripts:
bash
NOTIFIQ_URL="https://notify.yourdomain.com"
NOTIFIQ_TOKEN="YOUR_TOKEN"
notifiq() {
local title="$1"
local level="${2:-info}"
local message="${3:-}"
curl -sf -X POST "$NOTIFIQ_URL/api/notify" \
-H "Authorization: Bearer $NOTIFIQ_TOKEN" \
-H "Content-Type: application/json" \
-d "$(jq -n \
--arg t "$title" \
--arg l "$level" \
--arg m "$message" \
'{title:$t, level:$l, message:$m}')"
}
# Usage
notifiq "Backup complete" "success" "backup-job"
notifiq "Disk usage 95%" "critical" "cron" "Device /dev/sda1 is almost full"Python
python
import requests
def notifiq(title, level="info", message=""):
requests.post(
"https://notify.yourdomain.com/api/notify",
headers={"Authorization": "Bearer YOUR_TOKEN"},
json={"title": title, "level": level, "message": message},
timeout=5
)Cron job monitoring
bash
#!/bin/bash
# Wrap any command and notify on failure
CMD="$@"
OUTPUT=$(eval "$CMD" 2>&1)
EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
notifiq "Cron job failed: $CMD" "error" "cron" "$OUTPUT"
fi