this post was submitted on 27 Jul 2023
2 points (75.0% liked)

ntfy

1 readers
3 users here now

ntfy (pronounced notify) is a simple HTTP-based pub-sub notification service. You can use it to send push notifications to your phone via HTTP PUT/POST.

ntfy websiteDocumentationGitHubGoogle PlayF-DroidDiscordApp StoreMatrix

If you'd like to become a sponsor, I would be humbled to accept your donation via GitHub Sponsors or Liberapay 💸💰.

founded 1 year ago
MODERATORS
 

I have a self-hosted ntfy instance and I am gradually building a bare-bones mobile app to display my notifications.

I am publishing by POSTing as JSON. Is it possible for the ntfy server to send all the data fields that are included in the JSON? I would like to pass data in custom fields. Makes sense?

If this does not exist, is it possible to make a feature-request?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 1 year ago (1 children)

Can you make an example? Like, you want to just send custom fields when you publish the message and then pass it along to where?

[–] [email protected] 2 points 1 year ago (1 children)

My backend POSTs notification JSON to self-hosted ntfy server:

{
 "topic": "1234", 
 "message": "foo",
 "title": "bar",
 "customField": "baz"
}

The ntfy server should broadcast all fields, including customField to the websockets/subscribers of this topic.

Am I missing something?

[–] [email protected] 2 points 1 year ago (1 children)

Got it. Yeah no that's not supported. I have thought about adding that many times, but nobody's asked for it so far.

I'd probably call them extras though or something, so it'd be:

{
 "topic": "1234", 
 "message": "foo",
 "title": "bar",
 "extras": {
   "customField": "baz"
 }
}
[–] [email protected] 2 points 1 year ago (1 children)

That would work great! So anything sent under "extras" would be forwarded verbatim to the mobile app.

Is it too much trouble to implement?

[–] [email protected] 1 points 1 year ago

It's probably easy as pie to implement. Feel free to open a ticket on GitHub.