apprise-api
apprise-api copied to clipboard
Does the api support ntfy file attachments?
:question: Question
I looked through the documentation for ntfy on apprise and it appears that you are supposed to pass attach to get an image from a url. When calling the API, I can't seem to get it to work.
Here is an example curl
curl 'https://{url_to_apprise_api}/notify/apprise' --header 'Content-Type: application/json' --data '{
"tag": "testing",
"title": "test",
"body": "body",
"attach": "{url_to_image}"
}'
Try this:
curl -X POST \
-F 'urls=ntfy://details ' \
-F 'body=test message' \
-F [email protected] \
http://localhost:8000/notify
If you've saved your configuration in the API, then:
curl -X POST \
-F 'body=test message' \
-F [email protected] \
http://localhost:8000/notify/{key}/
I haven't heard back in a while, so i'm closing off this ticket
Hi @caronc and first off, thanks for building this brilliant project and the ongoing development. In terms of this issue, is there any reason why you do not give an external url in your examples (as per @gorrilla10101), as this works correctly if you use the Ntfy API directly but not through your Apprise API? I've tried using "attach" as a post field and using a JSON string but the picture does not appear in the push message, It also seems to ignore "Markdown" regardless of putting the Markdown field set to "yes" in either the header, as a field or in a JSON string.
Hi @flinthamm,
The markdown feature i hadn't realized it even existed, so I plan to solve this one, no worries here.
As for the attachments not working from the testing API, I'll give it a look and keep you posted. I'll reopen this ticket.
@flinthamm I merged the markdown
support into Apprise. It won't show into the Apprise API for a wee bit until i can get another release going. However there are instructions in the Dockerfile
attached with this project you can uncomment and build against the latest Apprise branch if you need it sooner.
As per the second issue with Attachments:
- I took the latest version of the Apprise API off of docker and started it up. I attached an image using just the testing area of the API and uploaded it successfully (sending it off to
ntfy://
as the end point):
- Then i opened up Ntfy on my phone and there the image was delivered properly:
Can you share with me what you may be doing differently? I can't seem to reproduce your issue.
Hi @caronc I recently discovered Apprise and it's an amazing tool, thanks for creating this. I'm trying the same problem using curl, to send an attachment.
The way shown above really works. However, the problem is when using curl with urls specifically (I haven't tried it with files, as I don't think I will need it)
Using this command does not work:
curl -X POST -F 'urls=ntfy://ntfy.mydomain.tld/test123' \
-F 'title=test title' \
-F 'body=test body' \
-F attach=https://raw.githubusercontent.com/walkxcode/dashboard-icons/0eaf38572d4b8a2485228eb5da98d356ca47f653/svg/uptime-kuma.svg \
"https://appr.mydomain.tld/notify/"
the result is:
Now if I use the cli with docker it works correctly:
docker container exec -it apprise-api apprise --body="Test Message" \
apprises://appr.domain.tld/apprise/?tags=all \
--attach=https://raw.githubusercontent.com/caronc/apprise/master/apprise/assets/themes/default/apprise-logo.png
I also tried with json , the result is that the message still does not appear:
curl -X POST -d '{"body":"Test message","title":"Test Title", "attach": "https://raw.githubusercontent.com/caronc/apprise/master/apprise/assets/themes/default/apprise-logo.png "}' \
-H "Content-Type: application/json" \
"https://appr.domain.tld/notify/apprise?tags=all"
So upon investigating this more, i think the issue is the confusion around the word attach
, you should be using attachment
when just passing through the API.
However, when using curl
's @
switch basically over-rides the -F
variable assignment and identifies it as a file (and no longer becomes part of the payload itself.
# Using -F (it doesn't matter what it's called); this works:
curl -X POST \
-F 'body=test message' \
-F [email protected] \
"https://appr.domain.tld/notify/apprise?tags=all"
# This does too:
curl -X POST \
-F 'body=test message' \
-F [email protected] \
"https://appr.domain.tld/notify/apprise?tags=all"
# and this does to; the thing is the @ with curl takes that variable and creates a new
# file/type section of the payload. In the below, only `body` gets pass
curl -X POST \
-F 'body=test message' \
-F [email protected] \
-F [email protected] \
"https://appr.domain.tld/notify/apprise?tags=all"
Now... when just passing using the API Payload, you must use attachment
variable. Here is some of the examples you used (but fixed):
# JSON Version
curl -X POST -d '{"body":"Test message","title":"Test Title", "attachment": "https://raw.githubusercontent.com/caronc/apprise/master/apprise/assets/themes/default/apprise-logo.png "}' \
-H "Content-Type: application/json" \
"https://appr.domain.tld/notify/apprise?tags=all"
# Form Version
curl -X POST \
-F 'body=test message' \
-F 'attachment=https://raw.githubusercontent.com/caronc/apprise/master/apprise/assets/themes/default/apprise-logo.png' \
http://localhost:8000/notify/{key}/
Let me know if this helps :rocket:
I'm adding an attach
keyword to just act as an alias of attachment
; this will help with the confusion i think a bit.
Edit: use caronc/apprise:edge
docker container to get the latest.
Thanks for the example, I must have missed this information in the documentation.
It's working perfectly, thank you.
Great, closing this ticket off as complete