Closed jkoor closed 1 month ago
Sure you can. You probably want json://
or jsons://
if using SSL.
You're Apprise URL might look something like (see here - specifically here):
json://host/?:message=content
The JSON payload uses title
already like you're expecting. It doesn't use body
, but does use message
which still isn't what you want. So the above maps it to content
like you're looking for.
There are a few more entries on the JSON payload. If you want to turn them off plus the mapping, you're URL could look like:
json://host/?:message=content&:version&:type
Thanks, maybe I didn't express myself clearly.
I use apprise to monitor my server and when the server provider detects a problem with the server, it sends me a message via appprise.
The route is probably like this:
Server provider
①→ apprise-api
②→ telegram://xxx
③→ me
My problem is in ①, The server provider only supports use title
and content
to send post request to a webhook url,I use apprise-api as the webhook url to receive the message.
After checking the log, I found that apprise-api will show error if the request parameter missing body
. So it can't reach ② stage.
My native language is not English, So maybe the expression is not very clear, Sorry.
I see what you're saying, at this time that isn't supported. But what is the name of the servce you're using. Perhaps i could add a /service/notify/
so it formats it the way the upstream service expects it?
Perhaps you can show me it's API as to how it ships the payload?
Also, i wonder if there would be value in making it so the apprise://
also supports the ?:key=value
mapping to help you out with your post. Hence everything i said above would still apply, except you would set your apprise URL to be:
apprise://host/?:content=body
That would map content
entry found in the payload to body
Would that work for you?
I see what you're saying, at this time that isn't supported. But what is the name of the servce you're using. Perhaps i could add a
/service/notify/
so it formats it the way the upstream service expects it?Perhaps you can show me it's API as to how it ships the payload?
I see what you're saying, at this time that isn't supported. But what is the name of the servce you're using. Perhaps i could add a
/service/notify/
so it formats it the way the upstream service expects it?Perhaps you can show me it's API as to how it ships the payload?
Thanks, the server provider is just an example. Because it seems that different websites have different request parameters.
Maybe Website A
send post request:
{
"title": "xxx",
"content": "xxx"
}
Website B
send post request:
{
"title": "xxx",
"message": "xxx"
}
So I think this way which adding a /service/notify/
to adapt the Website A
is not elegant.
Maybe chaning the way to map parameter is a better choice. I'm tring to modify the part of django
to identify ?:key=value
.
Thanks!
You closed this off. Did you want me to implement the :key=value
mapping?
You closed this off. Did you want me to implement the
:key=value
mapping?
If that's possible, that would be great!
I'm trying to modify the code in api/views.py:738-739
if not content.get('title') and 'title' in request.GET:
content['title'] = request.POST[request.GET['title']]
if not content.get('body') and 'body' in request.GET:
content['body'] = request.POST[request.GET['body']]
This method destroys the original logic and robustness of the code though it works successfully.
So If that's possible, that would be great! Thanks!
Closing this ticket off, as this feature has now been implemented.
:question: Question
Usually, apprise need
title
andbody
parameters to send message.However, the webhook from some websites or applications change these two request parameters. for example:
So is there an easy way to map
title
andbody
these two request parameters? For example, usehttps://localhost/notify?title=title&body=content
to maptitle
andbody
parameters.