# Option for JSON request bodies for URL destinations

**URL:** https://forum.hamalert.org/t/option-for-json-request-bodies-for-url-destinations/820
**Category:** Feature Requests
**Tags:** done
**Created:** [June 6, 2024, 11:03pm UTC](https://forum.hamalert.org/t/option-for-json-request-bodies-for-url-destinations/820 "2024-06-06T23:03:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![KC3YQI](https://forum.hamalert.org/user_avatar/forum.hamalert.org/kc3yqi/32/151_2.png) [@KC3YQI](https://forum.hamalert.org/u/KC3YQI)
#### Post date: [June 6, 2024, 11:03pm UTC](https://forum.hamalert.org/t/option-for-json-request-bodies-for-url-destinations/820/1 "2024-06-06T23:03:05Z")

</div>

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:

```sh
curl \
  --globoff \
  --data '{"title": "SIMULATED spot N0CALL (28.420 SSB)"}' \
  'https://ntfy.fediverse.radio/ham-alert-zwgssphq?tpl=1&m={{.title}}'

```

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

```sh
$ 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,  
Eric KC3YQI

---

<div class="post-metadata">

### Author: ![HB9DQM](https://forum.hamalert.org/user_avatar/forum.hamalert.org/hb9dqm/32/5_2.png) [@HB9DQM](https://forum.hamalert.org/u/HB9DQM)
#### Post date: [June 8, 2024, 7:55pm UTC](https://forum.hamalert.org/t/option-for-json-request-bodies-for-url-destinations/820/2 "2024-06-08T19:55:10Z")

</div>

> [@KC3YQI](#):
>
> 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.

That is a very reasonable request – done!

73, Manuel HB9DQM

---

<div class="post-metadata">

### Author: ![KC3YQI](https://forum.hamalert.org/user_avatar/forum.hamalert.org/kc3yqi/32/151_2.png) [@KC3YQI](https://forum.hamalert.org/u/KC3YQI)
#### Post date: [June 8, 2024, 8:39pm UTC](https://forum.hamalert.org/t/option-for-json-request-bodies-for-url-destinations/820/3 "2024-06-08T20:39:07Z")

</div>

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