Comments (9)
What would be the goal of this? Why not just send a custom JSON string as the body of the notification?
from ntfy.
The ntfy server currently only understands predefined properties in the POSTed JSON. Added custom properties do not get forwarded to the frontend. Use case is for self-hosted nfty servers with a custom frontend that needs fields beyond the known message
, title
etc.
This is the relevant discussion with @binwiederhier .
from ntfy.
I understand what you're asking for (and I agree with binwiederhier that it'd probably be easy to implement), but I don't understand why sending an (escaped) JSON string as the body of the message doesn't work. If you're already building a custom frontend, then you don't need to use any of ntfy's existing fields (except to get your JSON string out).
The current ntfy response looks like this:
{
"id":"fajyTv5FQ0iM",
"time":1690985276,
"expires":1691028476,
"event":"message",
"topic":"test",
"message":"testing"
}
You want to change it to this:
{
"id":"fajyTv5FQ0iM",
"time":1690985276,
"expires":1691028476,
"event":"message",
"topic":"test",
"message":"testing"
"extras": {
"customField": "value"
}
}
Then, after data = resp.json()
, you could access the custom value at data.extras.customField
Why not do this?
{
"id":"fajyTv5FQ0iM",
"time":1690985276,
"expires":1691028476,
"event":"message",
"topic":"test",
"message":"\"{\"message\": \"testing\", \"customField\": \"value\"}\""
}
Then, after data = resp.json().message.json()
, you could access the custom value at data.customField
, right?
from ntfy.
Just opened the issue because as @binwiederhier suggested
(a) this was something he had already considered doing before and
(b) the implementation is easy
Yes, what you propose would work. I'm not saying it wouldn't.
But cannibalizing the preexisting message
that has very specific semantics, is a hackey workaround.
from ntfy.
Got it. I hope you don't feel like I am dismissing the value of your proposal. I know other people have already been sending JSON strings with custom fields as the message
, so I wanted to make sure you weren't having problems with that.
And I'm sure they will also be happy to have a convenient extras
field where they can put additional information instead.
I will see if I can implement this sometime this week.
from ntfy.
I don't feel like that at all. I completely understand you asking for justification esp. when it comes to feature requests. After all it is I who makes a request for your time and effort.
Much appreciated regardless of whether you go ahead with its implementation or not.
from ntfy.
@wunter8 I see the fix. Would it be possible to also get arrays to be allowed values inside the extras
object?
from ntfy.
Any update on this?
from ntfy.
Nope. Sorry. I've been busy with work and haven't been able to finish the Android side of things yet
from ntfy.
Related Issues (20)
- Proxy connections HOT 2
- Rate-Topics can be used to DoS individual (public) topics HOT 1
- Panic in .handleAccountSubscriptionAdd, .. HOT 1
- Long attachment expiration are not working.... HOT 13
- Oh no, ntfy crashed!
- If the "Continuously active VPN" function is activated, ntfy does not recognise the network status
- iOS app crashes when swipe left is used with more than 1 message in a topic. HOT 1
- Feature Request: Friendly names for servers in notifications HOT 3
- Documentation for Using Tokens via PowerShell Appears to be Incorrect HOT 3
- log-level-overrides does not permit spaces in value string HOT 1
- Project ID error. The sisstem not recognize my firebase-key-file HOT 2
- email publishing - priority
- Allow to set image size in message
- [Just an info] Ntfy.sh default server timezone is in UTC timezone. HOT 1
- Ntfy server is impossible to set up on NixOS 23.11 HOT 1
- Implement Markdown on iOS
- HTTP 413: JSON body too large HOT 3
- Feature Request: log rotation HOT 1
- Login is disabled when NTFY_ENABLE_LOGIN: true HOT 3
- Triggering Webhook upon Receiving Notifications HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ntfy.