Sending Notifications via HTTP Requests with Ntfy.sh

posted Originally published at journal.manoedinata.com 1 min read

Looking to send a notification through a HTTP request? This post suits you then.

ntfy.sh is an HTTP-based notification service created by Philipp C. Heckel. Using this service, we can send any notifications to devices using HTTP requests, specifically POST or PUT. This service makes it easy for us to send notifications or alerts to our devices anywhere and anytime, such as during emergencies, security breaches, and so on.

Usage

Notifications are sent to an address called a topic. Users must subscribe to/create a topic using the mobile app, web UI, or through the API.

After creating a topic, users can send notifications that will appear on devices that are subscribed to that topic.

Example using curl:

$ curl ntfy.sh/manoe-test -X POST -d "Halo!"
{"id":"mhPWOSrOEPa6","time":1668311286,"event":"message","topic":"manoe-test","message":"Halo!"}

First notification

$ curl ntfy.sh/manoe-test -X POST \
    -H "Title: Tes Notifikasi" \
    -H "Priority: urgent" \
    -H "Tags: warning" \
    -d "Halo!"
{"id":"unEikqvUJXZm","time":1668311727,"event":"message","topic":"manoe-test","title":"Tes Notifikasi","message":"Halo!","priority":5,"tags":["warning"]}

Second notification

ntfy.sh is very useful for sending automated notifications through CLI or application integration, based on HTTP requests. ntfy.sh can be combined with automated tasks such as daily backups, storage capacity monitoring, and more.

If you read this far, tweet to the author to show them you care. Tweet a Thanks

Nice write-up! Really cool how ntfy.sh makes HTTP-based notifications so simple. I’m curious though—have you tried using it with more complex automations, like chaining notifications with scripts or integrating with monitoring tools? Thanks for sharing this!

Hi, thanks for checking in! Yup, some time before I've used it to send me a daily build notification, running from a GitHub Actions CI. Since it's a HTTP request, it could be integrated almost anywhere easily. You just need an Internet connection.

Probably will use it again with cron jobs for my daily server stuff. Really simple but shocking solution for notifications!

Wow! Very comprimising solution, i was having hard time sending myself Jenkins test results because google blocks zip and html results due to security, with that way i can receive without any issue!

More Posts

Simplifying HTTP Requests in React with Custom Hooks

ayoashy - Oct 14, 2024

Embracing the Suckless Philosophy: A Minimalist Approach to Computing and Life

nnisarggada - Mar 18

I Built tip.md to Help Open-Source Devs Get Crypto Tips via GitHub READMEs—What Do You Think?

tipdotmd - May 15

How I Automated Git Commands Using Batch Scripting

Ifeanyi - Apr 9

Learn to manage Laravel 10 queues for efficient job handling and implement real-time notifications seamlessly.

Gift Balogun - Jan 1
chevron_left