brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: give ntfy messages a title, priority and tags from curl

Ntfy
~/tips/tip-ntfy-curl-title-priority-tags

curl \

Sends a push notification with a title, priority and emoji from one curl command.

I run ntfy on my Unraid server, and a plain curl -d is how most scripts talk to it. A bare message works, but then every alert looks the same on a phone. A few extra headers fix that.

curl \
  -H "Title: Backup failed" \
  -H "Priority: high" \
  -H "Tags: warning,nas" \
  -d "Nightly backup of appdata stopped with an error" \
  https://ntfy.example.com/backups

Title replaces the default title, which is usually the topic URL. Priority runs from 1 to 5, or by name: min, low, default, high and max (or urgent). Tags takes a comma-separated list. A tag that matches an emoji shortcode, like warning, becomes an emoji in front of the title, and the others show up under the message.

One more I’d add to monitoring alerts is Click. It opens a URL when you tap the notification, so a failed backup alert can open the right dashboard straight away:

-H "Click: https://dash.example.com"

The same headers work on ntfy.sh and on your own server; only the URL changes.

Caveat: on ntfy.sh there’s no sign-up, and the docs say the topic name is essentially a password. Anyone who guesses it can read your alerts. Pick a long random topic name, or use your own server with access control, and use HTTPS there.

Further reading: ntfy docs: Publishing

More Ntfy tips curl -H "In: 30min" -d "Check the oven" ntfy.sh/mytopic All Ntfy tips (2) All topics

Link