Skip to content

Allow all parameters for publishing in JSON body (including topic) #133

Closed
@cmeis

Description

@cmeis

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:

curl -d '{
  "topic": "mytopic",
  "message": "This is a message",
  "title": "My title"
}' ntfy.sh

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestserverRelates to the main binary (server or client)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions