mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 16:35:53 +02:00
[GH-ISSUE #942] Using PHP example from doc for publishing JSON notification sends JSON object and is not interpreted by the server #660
Labels
No labels
ai-generated
android-app
android-app
android-app
🪲 bug
build
build
dependencies
docs
enhancement
enhancement
🔥 HOT
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
🔒 security
server
server
unified-push
web-app
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ntfy#660
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @godsgood33 on GitHub (Nov 9, 2023).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/942
🐞 Describe the bug
I am converting my notifier from PushBullet to a self-hosted Ntfy instance. It work great and the messages come through just like you think they should. However, the notification received is just the JSON object and not an interpreted display. Maybe I am doing something wrong.
💻 Components impacted
all
💡 Screenshots and/or logs
Code I wrote to send the message using the example in the doc:
This is what the notification looks from the web app

🔮 Additional context
I tried looking at the symfony/ntfy-notifier, but I am currently using Symfony 5.4 and that requires at least 6.4 and symfony/notifier 6.2
@wunter8 commented on GitHub (Nov 9, 2023):
Messages with JSON bodies need to be sent to
ntfy.domain.comand notntfy.domain.com/topic@godsgood33 commented on GitHub (Nov 10, 2023):
That didn't work. I got a 400 error. With and without the trailing '/'.
@wunter8 commented on GitHub (Nov 10, 2023):
I'm guessing your JSON is malformed. Specifically,
markdownhas to be a bool, not '1', so change your PHP message array to... ,'message' => true, ...@godsgood33 commented on GitHub (Nov 10, 2023):
That seemed to work. Turns out the problem was in the
__setmethod...I accidentally putstringfor the second parameter which cast thetrueto a string1. Thanks!