[GH-ISSUE #992] Is another webserve needed for pushing attachments outside ntfy UI? #694

Closed
opened 2026-05-07 00:26:39 +02:00 by BreizhHardware · 3 comments

Originally created by @bertod on GitHub (Dec 27, 2023).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/992

Question
Hello,

What
I'm sending push notifications on my self-hosted ntfy server and I need to send attachments as well. So, what I do is to write my attachments in the attachment-cache-dir as set in the server.yml. However, when doing this, the notification I received tries to find the attachment in <base_url>/file and fails.
When I create a new msg in the topic using ntfy UI, it uploads the attachment in the same dir but works.

Question
Is it really possible to make ntfy finding an attachment which is stored in the cache dir without using the UI? Do I need to change some setting?

My Workaround
I leverage on a different webserve (e.g., apache, nginx, whatever) and upload the attachment to it. In this way, it works (ofc, the POSTrequest header is changed accordingly)

Originally created by @bertod on GitHub (Dec 27, 2023). Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/992 <!-- Before you submit, consider asking on Discord/Matrix instead. You'll usually get an answer sooner, and there are more people there to help! - Discord: https://discord.gg/cT7ECsZj9w - Matrix: https://matrix.to/#/#ntfy:matrix.org / https://matrix.to/#/#ntfy-space:matrix.org --> :question: **Question** Hello, **What** I'm sending push notifications on my self-hosted ntfy server and I need to send attachments as well. So, what I do is to write my attachments in the `attachment-cache-dir` as set in the server.yml. However, when doing this, the notification I received tries to find the attachment in `<base_url>/file` and fails. When I create a new msg in the topic using ntfy UI, it uploads the attachment in the same dir but works. **Question** Is it really possible to make ntfy finding an attachment which is stored in the cache dir without using the UI? Do I need to change some setting? **My Workaround** I leverage on a different webserve (e.g., apache, nginx, whatever) and upload the attachment to it. In this way, it works (ofc, the POSTrequest header is changed accordingly)
BreizhHardware 2026-05-07 00:26:39 +02:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@wunter8 commented on GitHub (Dec 27, 2023):

ntfy does not support attachments that have been uploaded to the attachments directory by hand. When you add something by hand, ntfy doesn't know about it so it cannot attach it to any messages.

ntfy expects you to send a message to a topic with an attachment to the server (from anywhere). ntfy will extract the attachment, give it a unique ID, and save it in the attachments directory. It will then publish the message with (a link to download) the attachment to all subscribers of the topic. You can send the message with the attachment from the UI or from any other HTTP client (e.g., curl, httpie, python requests, etc.)

<!-- gh-comment-id:1870350224 --> @wunter8 commented on GitHub (Dec 27, 2023): ntfy does not support attachments that have been uploaded to the attachments directory by hand. When you add something by hand, ntfy doesn't know about it so it cannot attach it to any messages. ntfy expects you to send a message to a topic with an attachment to the server (from anywhere). ntfy will extract the attachment, give it a unique ID, and save it in the attachments directory. It will then publish the message with (a link to download) the attachment to all subscribers of the topic. You can send the message with the attachment from the UI or from any other HTTP client (e.g., curl, httpie, python requests, etc.)
Author
Owner

@bertod commented on GitHub (Dec 27, 2023):

yeah, makes sense. The only thing is that we would end up duplicating the image and we would need to manually delete one copy. It's not a big deal, but still.

Thank you! I'm gonna close this issue :)

<!-- gh-comment-id:1870478982 --> @bertod commented on GitHub (Dec 27, 2023): yeah, makes sense. The only thing is that we would end up duplicating the image and we would need to manually delete one copy. It's not a big deal, but still. Thank you! I'm gonna close this issue :)
Author
Owner

@wunter8 commented on GitHub (Dec 27, 2023):

If you skip the step of putting them in the attachments directory by hand and just use the UI/curl/httpie, you won't have any duplicates and everything would still work like normal, right?

<!-- gh-comment-id:1870484368 --> @wunter8 commented on GitHub (Dec 27, 2023): If you skip the step of putting them in the attachments directory by hand and just use the UI/curl/httpie, you won't have any duplicates and everything would still work like normal, right?
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#694
No description provided.