mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 08:26:00 +02:00
[GH-ISSUE #133] Allow all parameters for publishing in JSON body (including topic) #111
Labels
No labels
ai-generated
android-app
android-app
android-app
🪲 bug
build
build
dependencies
docs
enhancement
enhancement
🔥 HOT
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
🔒 security
server
server
unified-push
web-app
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ntfy#111
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @cmeis on GitHub (Feb 7, 2022).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/133
A generic way to publish via POST with JSON body (parameters like in URL parameters and HTTP headers) would be fantastic
As @binwiederhier wrote somewhere else something like this:
Regarding the question "That's not a bad idea, though I'm not sure I see the benefit over the other publishing methods.":
The concrete use case is an access control system (like in "smart door lock") that has webhooks, but doesn't allow for parameters in the URL. So if I want to post to different topics using a variable there (indicating the door opened for example), I can only do this in the request body.
Right now I solved it by routing the notification from the access control system over a NodeRED instance, which is relaying it to ntfy after massaging body and header to fit.
I hope that's a clear enough usage case. If it's not too hard to implement, this would make sending notifications via ntfy even more versatile. I suppose there would have to be a kind of "universal topic" to post this to, like "ntfy.sh/publish", "ntfy.sh/api/publish" or the like.
@binwiederhier commented on GitHub (Mar 15, 2022):
I think the feature is sound and easy to implement, though I don't quite know what the API would look like. If there is a universal topic as you say it's easy, but if you want to also publish to the individual topics it's kinda tricky.
Here are a few options:
Request body is assumed to be a JSON request with a well-formed message. Options for endpoint names:
Option 1a:
Option 1b:
Option 1c:
Option 1d:
Option 1e:
Option 1f (topic in the body JSON):
@binwiederhier commented on GitHub (Mar 15, 2022):
I think option 1f (universal endpoint) is the only one I truly like, since it's short and doesn't need a super weird parameter to identify that the body is a JSON message blob. It is kinda tricky to implement though I think.
@cmeis commented on GitHub (Mar 15, 2022):
Yeah, 1f would be my favourite, too....
Am 15. März 2022, 20:26, um 20:26, "Philipp C. Heckel" @.***> schrieb:
@binwiederhier commented on GitHub (Mar 16, 2022):
This is done and will be released with the next server release