Subscribe from your phone¶
You can use the ntfy Android App or iOS app to receive notifications directly on your phone. Just like the server, this app is also open source, and the code is available on GitHub (Android, iOS). Feel free to contribute, or build your own.
You can get the Android app from both Google Play and from F-Droid. Both are largely identical, with the one exception that the F-Droid flavor does not use Firebase. The iOS app can be downloaded from the App Store.
A picture is worth a thousand words. Here are a few screenshots showing what the app looks like. It's all pretty straight forward. You can add topics and as soon as you add them, you can publish messages to them.
If those screenshots are still not enough, here's a video:
When you publish messages to a topic, you can define a priority. This priority defines how urgently Android will notify you about the notification, and whether they make a sound and/or vibrate.
By default, messages with default priority or higher (>= 3) will vibrate and make a sound. Messages with high or urgent priority (>= 4) will also show as pop-over, like so:
You can change these settings in Android by long-pressing on the app, and tapping "Notifications", or from the "Settings" menu under "Channel settings". There is one notification channel for each priority:
Per notification channel, you can configure a channel-specific sound, whether to override the Do Not Disturb (DND) setting, and other settings such as popover or notification dot:
Instant delivery allows you to receive messages on your phone instantly, even when your phone is in doze mode, i.e. when the screen turns off, and you leave it on the desk for a while. This is achieved with a foreground service, which you'll see as a permanent notification that looks like this:
Android does not allow you to dismiss this notification, unless you turn off the notification channel in the settings. To do so, long-press on the foreground notification (screenshot above) and navigate to the settings. Then toggle the "Subscription Service" off:
Limitations without instant delivery: Without instant delivery, messages may arrive with a significant delay (sometimes many minutes, or even hours later). If you've ever picked up your phone and suddenly had 10 messages that were sent long before you know what I'm talking about.
The reason for this is Firebase Cloud Messaging (FCM). FCM is the only Google approved way to send push messages to Android devices, and it's what pretty much all apps use to deliver push notifications. Firebase is overall pretty bad at delivering messages in time, but on Android, most apps are stuck with it.
The ntfy Android app uses Firebase only for the main host
ntfy.sh, and only in the Google Play flavor of the app. It won't use Firebase for any self-hosted servers, and not at all in the the F-Droid flavor.
Share to topic¶
You can share files to a topic using Android's "Share" feature. This works in almost any app that supports sharing files or text, and it's useful for sending yourself links, files or other things. The feature remembers a few of the last topics you shared content to and lists them at the bottom.
The feature is pretty self-explanatory, and one picture says more than a thousand words. So here are two pictures:
The ntfy Android app supports deep linking directly to topics. This is useful when integrating with automation apps such as MacroDroid or Tasker, or to simply directly link to a topic from a mobile website.
Android deep linking of http/https links is very brittle and limited, which is why something like
https://<host>/<topic>/subscribe is not possible, and instead
ntfy:// links have to be used. More details in issue #20.
Supported link formats:
| || ||Directly opens the Android app detail view for the given topic and server. Subscribes to the topic if not already subscribed. This is equivalent to the web view |
| || ||Same as above, except that this will use HTTP instead of HTTPS as topic URL. This is equivalent to the web view |
UnifiedPush is a standard for receiving push notifications without using the Google-owned Firebase Cloud Messaging (FCM) service. It puts push notifications in the control of the user. ntfy can act as a UnifiedPush distributor, forwarding messages to apps that support it.
To use ntfy as a distributor, simply select it in one of the supported apps. That's it. It's a one-step installation 😀. If desired, you can select your own selfhosted ntfy server to handle messages. Here's an example with FluffyChat:
React to incoming messages¶
To react on incoming notifications, you have to register to intents with the
io.heckel.ntfy.MESSAGE_RECEIVED action (see code for details). Here's an example using MacroDroid and Tasker, but any app that can catch broadcasts is supported:
For MacroDroid, be sure to type in the package name
io.heckel.ntfy, otherwise intents may be silently swallowed. If you're using topics to drive automation, you'll likely want to mute the topic in the ntfy app. This will prevent notification popups:
Here's a list of extras you can access. Most likely, you'll want to filter for
topic and react on
| ||String|| ||Randomly chosen message identifier (likely not very useful for task automation)|
| ||String|| ||Root URL of the ntfy server this message came from|
| ||String|| ||Topic name; you'll likely want to filter for a specific topic|
| ||Boolean|| ||Indicates whether the subscription was muted in the app|
| ||String ( || ||Same as |
| ||Int|| ||Message date time, as Unix time stamp|
| ||String|| ||Message title; may be empty if not set|
| ||String|| ||Message body; this is likely what you're interested in|
| ||ByteArray|| ||Message body as binary data|
| ||String||-||Message encoding (empty or "base64")|
| ||String|| ||Comma-separated list of tags|
| ||String|| ||Map of tags to make it easier to map first, second, ... tag|
| ||Int (between 1-5)|| ||Message priority with 1=min, 3=default and 5=max|
| ||String|| ||Click action URL, or empty if not set|
| ||String|| ||Filename of the attachment; may be empty if not set|
| ||String|| ||Mime type of the attachment; may be empty if not set|
| ||Long|| ||Size in bytes of the attachment; may be zero if not set|
| ||Long|| ||Expiry date as Unix timestamp of the attachment URL; may be zero if not set|
| ||String|| ||URL of the attachment; may be empty if not set|
Send messages using intents¶
To send messages from other apps (such as MacroDroid and Tasker), you can broadcast an intent with the
io.heckel.ntfy.SEND_MESSAGE action. The ntfy Android app will forward the intent as a HTTP POST request to publish a message. This is primarily useful for apps that do not support HTTP POST/PUT (like MacroDroid). In Tasker, you can simply use the "HTTP Request" action, which is a little easier and also works if ntfy is not installed.
Here's what that looks like:
The following intent extras are supported when for the intent with the
| ||-||String|| ||Root URL of the ntfy server this message came from, defaults to |
| ||✔||String|| ||Topic name; you must set this|
| ||-||String|| ||Message title; may be empty if not set|
| ||✔||String|| ||Message body; you must set this|
| ||-||String|| ||Comma-separated list of tags|
| ||-||String or Int (between 1-5)|| ||Message priority with 1=min, 3=default and 5=max|