ntfy.sh - simple HTTP-based pub-sub
ntfy (pronounce: notify) is a simple HTTP-based pub-sub notification service. It allows you to send desktop notifications via scripts from any computer, entirely without signup or cost. It's also open source if you want to run your own.
Subscribe to a topic
Topics are created on the fly by subscribing to them. You can create and subscribe to a topic either in this web UI, or in your own app by subscribing to an EventSource, a JSON feed, or raw feed.
Because there is no sign-up, the topic is essentially a password, so pick something that's not easily guessable.
Subscribe via web
If you subscribe to a topic via this web UI in the field below, messages published to any subscribed topic will show up as desktop notification.
Topics:
Subscribe via your app, or via the CLI
Using EventSource, you can consume notifications like this (see full example):
const eventSource = new EventSource('https://ntfy.sh/mytopic/sse');
eventSource.onmessage = (e) => {
// Do something with e.data
};
Or you can use curl or any other HTTP library. Here's an example for the /json endpoint, which prints one JSON message per line (keepalive and open messages have an "event" field):
$ curl -s ntfy.sh/mytopic/json
{"time":1635359841,"event":"open"}
{"time":1635359844,"message":"This is a notification"}
{"time":1635359851,"event":"keepalive"}
Using the /sse endpoint (SSE, server-sent events stream):
$ curl -s ntfy.sh/mytopic/sse
event: open
data: {"time":1635359796,"event":"open"}
data: {"time":1635359803,"message":"This is a notification"}
event: keepalive
data: {"time":1635359806,"event":"keepalive"}
Using the /raw endpoint (empty lines are keepalive messages):
$ curl -s ntfy.sh/mytopic/raw
This is a notification
Publishing messages
Publishing messages can be done via PUT or POST using. Here's an example using curl:
curl -d "long process is done" ntfy.sh/mytopic
Here's an example in JS with fetch() (see full example):
fetch('https://ntfy.sh/mytopic', {
method: 'POST', // PUT works too
body: 'Hello from the other side.'
})
Messages published to a non-existing topic or a topic without subscribers will not be delivered later. There is (currently) no buffering of any kind. If you're not listening, the message won't be delivered.
FAQ
Isn't this like ...?
Who knows. I didn't do a lot of research before making this. It was fun making it.
Can I use this in my app? Will it stay free?
Yes. As long as you don't abuse it, it'll be available and free of charge. I do not plan on monetizing
the service.
What are the uptime guarantees?
Best effort.
Will you know what topics exist, can you spy on me?
If you don't trust me or your messages are sensitive, run your own server. It's open source.
That said, the logs do not contain any topic names or other details about you. Check the code if you don't believe me.