-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Dynamic Targets for Pre-Saved Notification Sources #37
Comments
Absolutely, But maybe not as granular as you'd like. You can run an NginX server in front of it. The Nginx configuration might look like this: server {
# To keep this example basic; we'll just listen on port 80
listen 80;
# Main Website/Relay
location / {
include uwsgi_params;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://apprise-hostname-or-ip:8000;
# Give ample time for notifications to fire
proxy_read_timeout 120s;
}
# Here is the security portion you're asking for the place your site behind a password:
auth_basic "Restricted Area";
auth_basic_user_file apprise.htpasswd;
} Now you just need to generate the # Generate a password file (-c option):
htpasswd -c /etc/nginx/apprise.htpasswd user1
# You'll be prompted for a password to associate with `user1`
# Now add future users too this way: (no -c because the db was already created):
htpasswd /etc/nginx/apprise.htpasswd user2
# You'll be prompted for a password to associate with `user2`
If you access your PC (assuming you've exposed port 80), you should be able to visit: Is this what you're asking? Or do you want like a user/pass combo to associate with individual |
Thanks for quick & comprehensive response
As you can see we didn't provide any telegram chat_id to our configuration, Now is there ability to set that chat_id while sending the message/notification? like this:
I used |
I see what you're saying. There is no way to do that. Not at this time anyway... I'd have to think about just passing variables back. # Effectively I'm loading a persistent storage with the entries:
# syntax is tag(s)=<url>
# team,joe=tgram://joes-token?format=html
# team,jason=tgram://jasons-token?format=html
curl -X POST 'http://apprise-hostname:8000/add/Telegram' \
-H 'Content-Type: application/json' \
--data '{"format": "text", "config": " \
team,joe=tgram://joes-token?format=html \
team,jason=tgram://jasons-token?format=html"}' Now we have 2 users defined each with their own tag ( # Notify everyone (using tag keyword):
curl -X POST http://apprise-hostname:8000/notify/Telegram -H 'Content-Type: application/json' \
-d '{"tag": "team", "title": "the very dear title", "body": "The long message we have"}'
# Just notify Jason:
curl -X POST http://apprise-hostname:8000/notify/Telegram -H 'Content-Type: application/json' \
-d '{"tag": "jason", "title": "the very dear title", "body": "The long message we have"}' Would this solve your problem? Or do you still see a good cause for variables? Thoughts? |
The way you told already came to my mind, but that's a bit static and I'm looking for a dynamic way. |
If we config only one service per key (which is not guarantied) we can simply have
And
|
Well...
No
You confused me a bit here 🙂 . I might need you to explain this again to me. You can identify more then one Just so we know we're talking about two things here (but i think i missed what you're asking):
|
Again I thank you and forgive me for making you confused |
Yeah, I hear you now.... Basically enable user authentication, and the The only catch is the Thoughts? |
Excuse me, I didn't catch your sentences!
Correct? Now what I am proposing/asking is ability to send notification like this:
which that |
I will think about this. It seems like a rather complicated request too accomplish something that's already solved. I do understand your argument:
My argument back is that with the current design you can do this already. It just means you need to post I also understand that your saying you also want to be able to pass in more than one target too. You mentioned working with an array of targets (such as Effectively:
Here is a simple dynamic bash example, but you can easily port the same logic into Python, Go, Rust, PHP, etc: #/bin/sh
# Dynamic Telegram Notifier Script
# Syntax:
# # just notify `target1`
# script.sh target1
# # Notify all our predefined targets (inside the script)
# script.sh
# # Notify 5 targets (one API call)
# script.sh target1 target2 target3 target4 target5
# Set our targets to whatever was passed into the script
TARGETS=$@
# If there were no targets defined, use a default list
[ -z "$TARGETS" ] && TARGETS="
abcd \
defg \
hijk \
"
# Set our telegram token
TOKEN="abcd-12234"
# Dynamically turn our targets into path based entries
# target1/target2/target3/targetN/....
URLPATH=$(echo $TARGETS | sed -e 's|[[:space:]]\+|/|g')
if [ ! -z "$URLPATH" ]; then
# If we have anyone to notify, do so:
URL="tgram://$TOKEN/$URLPATH/?format=html"
curl -X POST -H 'Content-Type: application/json' \
http://apprise-hostname:8000/notify \
-d '{"urls":"$URL", "title":"my notification title", "body":"my long & detailed notification body"}'
fi
Does this help at all? If you're still certain your request should be put into the Apprise-API code, can you just give me a use-case for it? I'm sorry that I've dragged this out for so long 🙂 . I'm just trying to understand the problem you're trying to solve and why you can't use the way that already exists and works? I foresee lots of issues by having the configuration file suddenly become dynamic. Configuration files are usually static; you set them up and let them be. If you want to dynamically work with the tool, then you just need to send it dynamically generated URLs. Thoughts? |
Hi again |
I'll think about it... At this time the idea doesn't really work because the only advantage i can see is if there was a way to create a private configuration file (hiding your personal credentials) and allowing users to just leverage the use of it (without knowing them). The thing is, the way Apprise-API works today is if you put your token into the configuration and share it with someone else, they can very easily access these details (so it's not protected). If your friends have your # A nice ordered response of your configuration; this makes writing your own
# front end API around Apprise very easy
curl http://apprise-hostname:8000//json/urls/{KEY}
# The method you already know about; this is actually what the Apprise
# CLI tool leverage's in order to fetch information from remote servers
curl -X POST http://apprise-hostname:8000/get/{KEY} Until the above commands are buried behind authentication associated with the
This was why I was saying to not use a fixed configuration if your data is dynamic; just dynamically generate the URL around the entries. Anyway, I'll leave this ticket open. Maybe someone else who might be scanning/browsing through will have comments or suggestions. I can see your idea; i just don't want to rush into it's execution because I think there might be alternative ways to handle it (or maybe another way we can enhance the code that will still help you out! 🙂 |
Firstly I thank you again for your patience and efforts you put on this topic.
This is completely correct.
This is also correct, but I already managed this with changing the routes, I routed everything to
Very good, thanks again |
Sorry for being late to the party, I am in process to implement this for one of my project and I really loved the concept of apprise. Its a wonderful product. However, I am stuck at the very same scenario now. I have a signal rest server running and we shoot messages to all of my new clients whenever needed from an automated solution. I want to trigger signal via apprise now and I didn't find a way to dynamically assign the receivers phone number via apprise. I can't save them statically inside configs. |
This request has come back several times now, so i'll have to reconsider it. I'm thinking: # Text Configuration
mailto://credentials/{{email}} or yaml urls:
- mailto://credentials/{{email}} Or even: urls:
- mailto://credentials:
to: {{email}} the problem is that Apprise will very much choke on this configuration, so the underlining libary is going to need a new variable in the But when it's enabled, anything you put in the curl -X POST \
-F '[email protected]' \
-F 'body=test message' \
http://apprise-hostname:8000/notify/my-key The above would extrapolate Because the Thoughts? |
I have to raise this ticket again. I can understand there are several implications, but that can be beneficial both using the API server or running from CLI or from python. Even locally I can define some basic service, like email server parameters, and then use it just passing in the parameters also the This way Apprise API server will become a notification HUB with more flexibility. In our use case, for example, we want to send email, slack and teams notification. We could define
and then use |
❓ Question
Hi,
At first I must say thanks to who made this nice tool & also all the contributors and then the question
Is there anyway to only set credentials as configurations and the rest like chat ids or emails later when sending notification/message?
The text was updated successfully, but these errors were encountered: