|
|
---
|
|
|
|
|
|
Alias: [""]
|
|
|
Tag: [""]
|
|
|
Date: 2022-02-13
|
|
|
DocType: "WebClipping"
|
|
|
Hierarchy:
|
|
|
TimeStamp:
|
|
|
Link: https://ntfy.sh/
|
|
|
location:
|
|
|
CollapseMetaTable: true
|
|
|
|
|
|
---
|
|
|
|
|
|
Parent:: [[Selfhosting|Self hosting]]
|
|
|
|
|
|
# ntfy.sh | Send push notifications to your phone or desktop via PUT/POST
|
|
|
|
|
|
**ntfy** (pronounce: _notify_) is a simple HTTP-based [pub-sub](https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern) notification service. It allows you to send notifications to your phone or desktop via scripts from any computer, entirely **without signup, cost or setup**. It's also [open source](https://github.com/binwiederhier/ntfy) if you want to run your own.
|
|
|
|
|
|
[![](https://ntfy.sh/static/img/screenshot-curl.png)](https://ntfy.sh/static/img/screenshot-curl.png) [![](https://ntfy.sh/static/img/screenshot-web-detail.png)](https://ntfy.sh/static/img/screenshot-web-detail.png) [![](https://ntfy.sh/static/img/screenshot-phone-main.jpg)](https://ntfy.sh/static/img/screenshot-phone-main.jpg) [![](https://ntfy.sh/static/img/screenshot-phone-detail.jpg)](https://ntfy.sh/static/img/screenshot-phone-detail.jpg) [![](https://ntfy.sh/static/img/screenshot-phone-notification.jpg)](https://ntfy.sh/static/img/screenshot-phone-notification.jpg)
|
|
|
|
|
|
Publishing messages
|
|
|
-------------------
|
|
|
|
|
|
[Publishing messages](https://ntfy.sh/docs/publish/) can be done via PUT or POST. Topics are created on the fly by subscribing or publishing to them. Because there is no sign-up, **the topic is essentially a password**, so pick something that's not easily guessable.
|
|
|
|
|
|
Here's an example showing how to publish a message using a POST request (via curl -d):
|
|
|
|
|
|
`curl -d "Backup successful 😀" ntfy.sh/mytopic`
|
|
|
|
|
|
There are [more features](https://ntfy.sh/docs/publish/) related to publishing messages: You can set a [notification priority](https://ntfy.sh/docs/publish/#message-priority), a [title](https://ntfy.sh/docs/publish/#message-title), and [tag messages](https://ntfy.sh/docs/publish/#tags-emojis). Here's an example using some of them together:
|
|
|
|
|
|
`curl \ -H "Title: Unauthorized access detected" \ -H "Priority: urgent" \ -H "Tags: warning,skull" \ -d "Remote access to $(hostname) detected. Act right away." \ ntfy.sh/mytopic`
|
|
|
|
|
|
Here's what that looks like in the [Android app](https://ntfy.sh/docs/subscribe/phone/):
|
|
|
|
|
|
![](https://ntfy.sh/static/img/priority-notification.png)
|
|
|
|
|
|
Urgent notification with pop-over
|
|
|
|
|
|
Subscribe to a topic
|
|
|
--------------------
|
|
|
|
|
|
You can create and subscribe to a topic either [using your phone](https://ntfy.sh/docs/subscribe/phone/), in [this web UI](https://ntfy.sh/docs/subscribe/web/), or in your own app by [subscribing via the API](https://ntfy.sh/docs/subscribe/api/).
|
|
|
|
|
|
### Subscribe from your phone
|
|
|
|
|
|
Simply get the app and start [publishing messages](https://ntfy.sh/docs/publish/). To learn more about the app, [check out the documentation](https://ntfy.sh/docs/subscribe/phone/).
|
|
|
|
|
|
[![](https://ntfy.sh/static/img/badge-googleplay.png)](https://play.google.com/store/apps/details?id=io.heckel.ntfy) [![](https://ntfy.sh/static/img/badge-fdroid.png)](https://f-droid.org/en/packages/io.heckel.ntfy/) [![](https://ntfy.sh/static/img/badge-appstore.png)](https://github.com/binwiederhier/ntfy/issues/4)
|
|
|
|
|
|
Here's a video showing the app in action:
|
|
|
|
|
|
Sending push notifications to your Android phone
|
|
|
|
|
|
### Subscribe in this Web UI
|
|
|
|
|
|
Subscribe to topics here and receive messages as **desktop notification**. Topics are not password-protected, so choose a name that's not easy to guess.
|
|
|
|
|
|
### Subscribe using the API
|
|
|
|
|
|
There's a super simple API that you can use to integrate your own app. You can consume a [JSON stream](https://ntfy.sh/docs/subscribe/api/#subscribe-as-json-stream), an [SSE/EventSource stream](https://ntfy.sh/docs/subscribe/api/#subscribe-as-sse-stream) (useful for web apps), as well as a [plain text stream](https://ntfy.sh/docs/subscribe/api/#subscribe-as-raw-stream).
|
|
|
|
|
|
Here's an example for JSON. The **connection stays open**, so you can retrieve messages as they come in:
|
|
|
|
|
|
`$ curl -s ntfy.sh/mytopic/json {"id":"SLiKI64DOt","time":1635528757,"event":"open","topic":"mytopic"} {"id":"hwQ2YpKdmg","time":1635528741,"event":"message","topic":"mytopic","message":"Hi!"} {"id":"DGUDShMCsc","time":1635528787,"event":"keepalive","topic":"mytopic"} ...`
|
|
|
|
|
|
Here's a short video demonstrating it in action:
|
|
|
|
|
|
Subscribing to the JSON stream with curl
|
|
|
|
|
|
### Check out the docs!
|
|
|
|
|
|
ntfy has so many more features and you can learn about all of them [in the documentation](https://ntfy.sh/docs/) (I tried my very best to make it the best docs ever 😉, not sure if I succeeded, hehe).
|
|
|
|
|
|
[![](https://ntfy.sh/static/img/screenshot-docs.png)](https://ntfy.sh/docs/)
|
|
|
|
|
|
Check out the documentation
|
|
|
|
|
|
### 100% open source & forever free
|
|
|
|
|
|
I love free software, and I'm doing this because it's fun. I have no bad intentions, and I will never monetize or sell your information. This service will always stay [free and open](https://github.com/binwiederhier/ntfy). You can read more in the [FAQs](https://ntfy.sh/docs/faq/) and in the [privacy policy](https://ntfy.sh/docs/privacy/).
|
|
|
|
|
|
_Made with ❤️ by [Philipp C. Heckel](https://heckel.io/)_ |