Option for JSON request bodies for URL destinations

I use a deGoogled android phone which prevents the HamAlert app from sending me notifications. As a stop-gap, I learned that the ntfy service provides a mechanism for notifications to be sent to my phone via an HTTP request. It also supports templating of the request body if the request body is application/json.

For instance if I make the following request:

curl \
  --globoff \
  --data '{"title": "SIMULATED spot N0CALL (28.420 SSB)"}' \

My phone will be notified with the title of the simulated spot.

I attempted to use that URL with the URL destination and it didn’t work. I came to learn that the data that Ham Alert sends is in application/x-www-form-urlencoded.

That is a sensible choice to make. All web frameworks are able to parse data in that format.

Unfortunately ntfy only accepts application/json and returns a 400 if I send it form data

$ curl \
>   --globoff \
>   --data 'SIMULATED%20spot%20N0CALL%20%2828.420%20SSB%29' \
>   'https://ntfy.fediverse.radio/ham-alert-zwgssphq?tpl=1&m={{.title}}'

{"code":40042,"http":400,"error":"invalid request: message body must be JSON if templating is enabled","link":"https://ntfy.sh/docs/publish/#message-templating"}

I was wondering if an option could be added to the URL destination to post application/json data? That would enable me to be able to receive notifications on my phone via ntfy.

Thank you and 73,

That is a very reasonable request – done!

73, Manuel HB9DQM

Oh wow! Thanks for doing this. I appreciate it. Do you have a donate link? I’ll send you a meal as thanks