[GH-ISSUE #20] Opening ntfy.sh link in a browser on Android opens the app and subscribes to the topic if the app is installed #16

Closed
opened 2026-05-07 00:18:34 +02:00 by BreizhHardware · 17 comments

Originally created by @Copephobia on GitHub (Nov 24, 2021).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/20

A scenario may be:

  • I have the ntfy.sh app installed on my Android device
  • A browser page or application (like Slack) has a URL to a ntfy.sh topic

If I click on the ntfy.sh link, it will attempt to open the app and subscribe to the topic, so that I can view it from there.

If I do not have the ntfy.sh link, it will display the web page for that topic.

Originally created by @Copephobia on GitHub (Nov 24, 2021). Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/20 A scenario may be: - I have the ntfy.sh app installed on my Android device - A browser page or application (like Slack) has a URL to a ntfy.sh topic If I click on the ntfy.sh link, it will attempt to open the app and subscribe to the topic, so that I can view it from there. If I do not have the ntfy.sh link, it will display the web page for that topic.
Author
Owner

@binwiederhier commented on GitHub (Nov 24, 2021):

I like this idea. And it should not be hard to implement.

<!-- gh-comment-id:978485276 --> @binwiederhier commented on GitHub (Nov 24, 2021): I like this idea. And it should not be hard to implement.
Author
Owner

@binwiederhier commented on GitHub (Dec 13, 2021):

Re-opening this, since I removed the feature in the latest commit. Android is not allowing me to register reg-ex patterns of URLs and the wildcard stuff seems incredibly buggy. I spent two+ hours with it yesterday and it's not worth it for now.

<!-- gh-comment-id:992540574 --> @binwiederhier commented on GitHub (Dec 13, 2021): Re-opening this, since I removed the feature in the latest commit. Android is not allowing me to register reg-ex patterns of URLs and the wildcard stuff seems incredibly buggy. I spent two+ hours with it yesterday and it's not worth it for now.
Author
Owner

@gc-ss commented on GitHub (Dec 31, 2021):

Let's simplify it first?

  1. Instead of handling http(s) links, let the app respond to ntfy links and the app registers to handle ntfy links
  2. Have a little text template that spits out the http(s) links and the ntfy link to send to people (instead of just http(s) link)

Is this a possibility?

<!-- gh-comment-id:1003230827 --> @gc-ss commented on GitHub (Dec 31, 2021): Let's simplify it first? 1. Instead of handling http(s) links, let the app respond to `ntfy` links and the app registers to handle `ntfy` links 2. Have a little text template that spits out the http(s) links and the `ntfy` link to send to people (instead of just http(s) link) Is this a possibility?
Author
Owner

@binwiederhier commented on GitHub (Dec 31, 2021):

I wrote a whole long paragraph about why that's difficult and then I read your comment again. You just want a Share button that prints two links, one of which will open the app?

I don't know if Android will highlight and let you click ntfy:// links, probably not, but it's worth a try definitely.

And we'd still need a solution for the web UI.

<!-- gh-comment-id:1003234896 --> @binwiederhier commented on GitHub (Dec 31, 2021): I wrote a whole long paragraph about why that's difficult and then I read your comment again. You just want a Share button that prints two links, one of which will open the app? I don't know if Android will highlight and let you click ntfy:// links, probably not, but it's worth a try definitely. And we'd still need a solution for the web UI.
Author
Owner

@gc-ss commented on GitHub (Dec 31, 2021):

I wrote a whole long paragraph about why that's difficult and then I read your comment again

Philipp, then I did a poor job of conveying my intention. In case you happen to have that paragraph, I would really appreciate reading it. If it's gone, can you just type in the highlights so I can figure out what disconnect existed (before you read my comment again)?

You just want a Share button that prints two links, one of which will open the app?

Right. My thought is that the app can register itself with ntfy:// links and have greater control

And we'd still need a solution for the web UI.

I believe we can still use ntfy:// links or something similar (the client app can register itself with ntfy:// links)

<!-- gh-comment-id:1003238803 --> @gc-ss commented on GitHub (Dec 31, 2021): > I wrote a whole long paragraph about why that's difficult and then I read your comment again Philipp, then I did a poor job of conveying my intention. In case you happen to have that paragraph, I would really appreciate reading it. If it's gone, can you just type in the highlights so I can figure out what disconnect existed (before you read my comment again)? > You just want a Share button that prints two links, one of which will open the app? Right. My thought is that the app can register itself with `ntfy://` links and have greater control > And we'd still need a solution for the web UI. I believe we can still use `ntfy://` links or something similar (the client app can register itself with `ntfy://` links)
Author
Owner

@12nick12 commented on GitHub (Jan 17, 2022):

I'm not a dev, but going from what has been spoken in the issue and my limited knowledge of stuff, you could just add a ntfy: link in the web page if you can get ntfy app to open ntfy: links. Kind of link how tel: opens the dialer and mailto: opens email.

<!-- gh-comment-id:1014122369 --> @12nick12 commented on GitHub (Jan 17, 2022): I'm not a dev, but going from what has been spoken in the issue and my limited knowledge of stuff, you could just add a ntfy: link in the web page if you can get ntfy app to open ntfy: links. Kind of link how tel: opens the dialer and mailto: opens email.
Author
Owner

@binwiederhier commented on GitHub (Jan 17, 2022):

That would be easy to do, but then it looks horribly broken for people that don't have the app installed.

<!-- gh-comment-id:1014129896 --> @binwiederhier commented on GitHub (Jan 17, 2022): That would be easy to do, but then it looks horribly broken for people that don't have the app installed.
Author
Owner

@12nick12 commented on GitHub (Jan 17, 2022):

You could word something like "if you have the app installed hit THIS link"

<!-- gh-comment-id:1014504730 --> @12nick12 commented on GitHub (Jan 17, 2022): You could word something like "if you have the app installed hit THIS link"
Author
Owner

@jhotmann commented on GitHub (Mar 31, 2022):

For me, having the app able to handle ntfy:// links would be enough as I mainly just want to be able to open the app to a specific topic via Tasker. But having a ntfy:// link show up if you open a topic in a mobile browser could also be handy.

I wrote a custom Owntracks server implementation and part of it includes device configuration generation. It creates an owntracks:// links with the configuration data base64 encoded and is clickable from the Android and iOS browsers. The links aren't highlighted/clickable in messaging and other apps, though.

<!-- gh-comment-id:1084746129 --> @jhotmann commented on GitHub (Mar 31, 2022): For me, having the app able to handle `ntfy://` links would be enough as I mainly just want to be able to open the app to a specific topic via Tasker. But having a `ntfy://` link show up if you open a topic in a mobile browser could also be handy. I wrote a custom Owntracks server implementation and part of it includes device configuration generation. It creates an `owntracks://` links with the configuration data base64 encoded and is clickable from the Android and iOS browsers. The links aren't highlighted/clickable in messaging and other apps, though.
Author
Owner

@binwiederhier commented on GitHub (Apr 7, 2022):

Sorry I never responded to this. This sounds easy enough. I should be able to whip that up at some point. There are just so many tickets :-D

<!-- gh-comment-id:1090961200 --> @binwiederhier commented on GitHub (Apr 7, 2022): Sorry I never responded to this. This sounds easy enough. I should be able to whip that up at some point. There are just so many tickets :-D
Author
Owner

@binwiederhier commented on GitHub (Apr 12, 2022):

(I'm starting work on this)

So if I implement ntfy://ntfy.sh/mytopic that opens the topic in the Android app and subscribes to it, that would be enough?

I wonder if I should structure the link differently, so that other actions are supported in the future, like ntfy://ntfy.sh/mytopic?action=subscribe, or ntfy://subscribe/ntfy.sh/mytopic, ...

I suppose I could iterate on it, so I think I'll just start with ntfy://ntfy.sh/mytopic.

<!-- gh-comment-id:1095815449 --> @binwiederhier commented on GitHub (Apr 12, 2022): (I'm starting work on this) So if I implement `ntfy://ntfy.sh/mytopic` that opens the topic in the Android app and subscribes to it, that would be enough? I wonder if I should structure the link differently, so that other actions are supported in the future, like `ntfy://ntfy.sh/mytopic?action=subscribe`, or `ntfy://subscribe/ntfy.sh/mytopic`, ... I suppose I could iterate on it, so I think I'll just start with `ntfy://ntfy.sh/mytopic`.
Author
Owner

@binwiederhier commented on GitHub (Apr 12, 2022):

https://github.com/binwiederhier/ntfy-android/pull/24/files implements this:

  • ntfy://myhost.lan/mytopic --> subscribes to https://myhost.lan/mytopic (if not already subscribed) and shows it
  • ntfy://myhost.lan/mytopic?secure=false --> subscribes to http://myhost.lan/mytopic (if not already subscribed) and shows it

I think this is all there is to it. All that's missing is documentation for it.

To test:

adb shell am start -W -a android.intent.action.VIEW -d "ntfy://10.0.2.2/abc?secure=false" io.heckel.ntfy
<!-- gh-comment-id:1095836942 --> @binwiederhier commented on GitHub (Apr 12, 2022): https://github.com/binwiederhier/ntfy-android/pull/24/files implements this: - `ntfy://myhost.lan/mytopic` --> subscribes to `https://myhost.lan/mytopic` (if not already subscribed) and shows it - `ntfy://myhost.lan/mytopic?secure=false` --> subscribes to `http://myhost.lan/mytopic` (if not already subscribed) and shows it I think this is all there is to it. All that's missing is documentation for it. To test: ``` adb shell am start -W -a android.intent.action.VIEW -d "ntfy://10.0.2.2/abc?secure=false" io.heckel.ntfy ```
Author
Owner

@binwiederhier commented on GitHub (Apr 13, 2022):

Done. Will be in the next Android release. Added docs too, which will be in the next server release:

220412 20-09-42 Selection 001

<!-- gh-comment-id:1097413842 --> @binwiederhier commented on GitHub (Apr 13, 2022): Done. Will be in the next Android release. Added docs too, which will be in the next server release: ![220412 20-09-42 Selection 001](https://user-images.githubusercontent.com/664597/163074449-a66deba4-2090-47ff-addf-f031cc802cc6.png)
Author
Owner

@adebisi-fa commented on GitHub (Nov 15, 2024):

Hi @binwiederhier,

Thanks for this great piece of work. ntfy is awesome!

Could we have the subscription's appearance setting (e.g. name and icon) configured via ntfy: // protocol, also?

Something like this:

ntfy://<hostname>/<topic>?name=<SubscriptionName>&icon=<IconUrl>&secure=<true|false>

It would be a great addition!

Thanks once again for this great project.

<!-- gh-comment-id:2478245093 --> @adebisi-fa commented on GitHub (Nov 15, 2024): Hi @binwiederhier, Thanks for this great piece of work. ntfy is awesome! Could we have the subscription's appearance setting (e.g. name and icon) configured via ntfy: // protocol, also? Something like this: `ntfy://<hostname>/<topic>?name=<SubscriptionName>&icon=<IconUrl>&secure=<true|false>` It would be a great addition! Thanks once again for this great project.
Author
Owner

@reslin commented on GitHub (Dec 1, 2024):

Hi @adebisi-fa!

Could we have the subscription's appearance setting (e.g. name and icon) configured via ntfy: // protocol, also?

Something like this:

ntfy://<hostname>/<topic>?name=<SubscriptionName>&icon=<IconUrl>&secure=<true|false>

Because this issue being over 2 years old, you maybe better open a new issue.

I have a similar request with deep links, but the issue (+PR, if I hopefully can provide some code) which I'll open soon will be on "mutating" topics rather than updating them.
(Meaning: add new topics and delete old ones, in one step... I thought "mutate" would be a fitting term.)

If you look at
https://github.com/binwiederhier/ntfy-android/blob/main/app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt
line 99, you see this .getBooleanQueryParameter(...) method, and surely there are other methods like .getStringQueryParameter(...) which can serve your purpose.

In addition to the existing
ntfy://<host>/<topic>[?secure={true|false}] deep link I'm planning to introduce something like
ntfy://<host>/mutate?{sub|del|wipe}=<name|prefix>[&secure={true|false}]

(And that should allow even for something like this (wipe = wildcard delete):
ntfy://<host>/mutate?sub=new_topic_UUID&del=old_topic_UUID&wipe=topic_with_prefix_XYZ[&...].

See? You could concatenate "endless" key-value pairs, like so:
ntfy://<host>/mutate?sub=new_topic_1&sub=new_topic_2&sub=new_topic_3.)

Therefore your suggestion, or alternatively
ntfy://<host>/update?name=<name>&icon=<iconurl>[&secure={true|false}]
seems to be possible.

Best regards, Uwe

PS: I used <> denoting a mandatory input, {} denoting a set of possible values/commands and [] denoting a non-mandatory input. - Don't know if that's fully orthodox and correct, but you get the idea ;-)

<!-- gh-comment-id:2510280990 --> @reslin commented on GitHub (Dec 1, 2024): Hi @adebisi-fa! > Could we have the subscription's appearance setting (e.g. name and icon) configured via ntfy: // protocol, also? > > Something like this: > > `ntfy://<hostname>/<topic>?name=<SubscriptionName>&icon=<IconUrl>&secure=<true|false>` Because this issue being over 2 years old, you maybe better open a new issue. I have a similar request with deep links, but the issue (+PR, if I hopefully can provide some code) which I'll open soon will be on "mutating" topics rather than updating them. (Meaning: add new topics and delete old ones, in one step... I thought "mutate" would be a fitting term.) If you look at https://github.com/binwiederhier/ntfy-android/blob/main/app/src/main/java/io/heckel/ntfy/ui/DetailActivity.kt line 99, you see this `.getBooleanQueryParameter(...)` method, and surely there are other methods like `.getStringQueryParameter(...)` which can serve your purpose. In addition to the existing `ntfy://<host>/<topic>[?secure={true|false}]` deep link I'm planning to introduce something like `ntfy://<host>/mutate?{sub|del|wipe}=<name|prefix>[&secure={true|false}]` (And that should allow even for something like this (`wipe` = wildcard delete): `ntfy://<host>/mutate?sub=new_topic_UUID&del=old_topic_UUID&wipe=topic_with_prefix_XYZ[&...]`. See? You could concatenate "endless" key-value pairs, like so: `ntfy://<host>/mutate?sub=new_topic_1&sub=new_topic_2&sub=new_topic_3`.) Therefore your suggestion, or alternatively `ntfy://<host>/update?name=<name>&icon=<iconurl>[&secure={true|false}]` seems to be possible. Best regards, Uwe PS: I used `<>` denoting a mandatory input, `{}` denoting a set of possible values/commands and `[]` denoting a non-mandatory input. - Don't know if that's fully orthodox and correct, but you get the idea ;-)
Author
Owner

@e0548965 commented on GitHub (Jul 18, 2025):

Did you manage to do this @reslin ? We'd like to be able to set the subscription name to something more user friendly.

<!-- gh-comment-id:3086886430 --> @e0548965 commented on GitHub (Jul 18, 2025): Did you manage to do this @reslin ? We'd like to be able to set the subscription name to something more user friendly.
Author
Owner

@reslin commented on GitHub (Jul 19, 2025):

Did you manage to do this @reslin ? We'd like to be able to set the subscription name to something more user friendly.

Sorry, I did not pursue the topic further.

<!-- gh-comment-id:3092526308 --> @reslin commented on GitHub (Jul 19, 2025): > Did you manage to do this [@reslin](https://github.com/reslin) ? We'd like to be able to set the subscription name to something more user friendly. Sorry, I did not pursue the topic further.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ntfy#16
No description provided.