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: ntfy In and At headers deliver a notification later

Ntfy
~/tips/tip-ntfy-delay-scheduled-message

curl -H "In: 30min" -d "Check the oven" ntfy.sh/mytopic

Holds a notification on the ntfy server and delivers it after a delay or at a set time.

Most of the time I want a ntfy message right now. Sometimes I’d rather fire it off today and have it show up later, like a reminder. You don’t need a cron job on your own machine for that, because the ntfy server can hold the message for you.

curl -H "In: 30min" -d "Check the oven" ntfy.sh/mytopic
curl -H "At: tomorrow, 10am" -d "Good morning" ntfy.sh/mytopic

The header is X-Delay, and Delay, At, In (plus X-At and X-In) work as aliases. The value can be a duration like 30m or 2 days, a Unix timestamp, an RFC3339 timestamp or a natural-language time such as Tuesday, 7am. Replace ntfy.sh with your own server and the topic with yours.

Natural-language times use the server’s timezone unless you add a Timezone header with an IANA name, for example Timezone: Europe/Amsterdam.

The caveats are in the docs. The delay has to be between 10 seconds and 3 days, and the server admin can change that with the message-delay-limit option. A scheduled message is kept in the server cache until 12 hours after it was delivered, so it cannot be combined with Cache: no.

The current docs also describe cancelling a scheduled message. Publish it to a topic with your own sequence ID, like ntfy.sh/mytopic/break-reminder, and later send curl -X DELETE ntfy.sh/mytopic/break-reminder. I’d check that your server version supports it before relying on it.

Further reading: ntfy docs: scheduled delivery

More Ntfy tips curl \ All Ntfy tips (2) All topics

Link