Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: ntfy token support #353

Closed
ksurl opened this issue May 23, 2023 · 11 comments
Closed

feature request: ntfy token support #353

ksurl opened this issue May 23, 2023 · 11 comments

Comments

@ksurl
Copy link

ksurl commented May 23, 2023

add support for access tokens: https://docs.ntfy.sh/config/#access-tokens in place of username:password

@ksurl ksurl changed the title ntfy token support feature request: ntfy token support May 23, 2023
@piksel
Copy link
Member

piksel commented May 23, 2023

You can simply just omit the username, and it should work I think?

@ksurl
Copy link
Author

ksurl commented May 23, 2023

no it gets a 401 unauthorized. using this format: ntfy://:token@ntfy.domain/topic

it works with a query param with generic webhook like generic+https://ntfy.domain/topic?auth=param

you generate the param string with echo -n "Bearer TOKEN" | base64 | tr -d '='

@MyWay
Copy link

MyWay commented Jun 4, 2023

+1 for this

@cwschulz
Copy link

ntfy://:token@ntfy.domain/topic does seem to work for me but I'm unable to get the title to display, only shows a random 12 characters when using ntfy://:token@ntfy.domain/topic?Title=foo. Other params like Tag and Priority do work however.

@piksel
Copy link
Member

piksel commented Sep 17, 2023

@cwschulz Applications can override the title, which is probably why it's a random string (I'm guessing it's the docker container hostname). If you are using watchtower you can add the --notification-skip-title flag to keep the title in the query string.

@ksurl
Copy link
Author

ksurl commented Sep 17, 2023

ntfy://:token@ntfy.domain/topic does seem to work for me but I'm unable to get the title to display, only shows a random 12 characters when using ntfy://:token@ntfy.domain/topic?Title=foo. Other params like Tag and Priority do work however.

Which version are you using and in what app? It was not working when i first opened this issue. Good news if its in the release version now.

@ksurl
Copy link
Author

ksurl commented Nov 30, 2023

this is now supported with #377

use generic+https://ntfy.$DOMAIN/topic?@authorization=Bearer+$TOKEN

@ksurl ksurl closed this as completed Nov 30, 2023
@mrjackyliang
Copy link

Can the documentation be updated to show examples on how I can best use this?

I read the implementation and tests and I only have a subset of knowledge on how I can leverage it.

@piksel
Copy link
Member

piksel commented Dec 24, 2023

Yeah. I plan to add native support for this as well in the ntfy service though, so I think that when I get time to work on this I would rather do that.

@mrjackyliang
Copy link

Yeah. I plan to add native support for this as well in the ntfy service though, so I think that when I get time to work on this I would rather do that.

Awesomeness! Thanks for working on it!!

@KetchupBomb
Copy link

KetchupBomb commented May 25, 2024

ntfy://:token@ntfy.domain/topic does seem to work for me but I'm unable to get the title to display, only shows a random 12 characters when using ntfy://:token@ntfy.domain/topic?Title=foo. Other params like Tag and Priority do work however.

Which version are you using and in what app? It was not working when i first opened this issue. Good news if its in the release version now.

I was about to make a long post about @cwschulz's suggestion working in Watchtower, but I now think that this issue is probably just missing a commit that enables this feature, because even using shoutrrr directly works:

$ docker run -it --rm containrrr/shoutrrr --version
shoutrrr version 0.8.0

$ docker run -it --rm containrrr/shoutrrr send -u ntfy://:tk_3fxREDACTED@ntfy.DOMAIN/TOPIC -m 'shoutrrr CLI'
Notification sent

I didn't see anything in the Ntfy service documentation about tokens being supported. A surprise, to be sure, but a welcome one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants