Cannot get apprise to send ntfy notification to ntfy server, curl command works
viscount-monty opened this issue · 6 comments
❓ Question
Greetings,
I am unable to send a notification to my ntfy server (known to be working, as seen with curl
command further below) hosted at:
https://{mydomain}
With apprise using the following command:
~/BirdNET-Pi/birdnet/bin/apprise -vvv -t 'Test Title' -b 'Test body of notification that is a bit longer than the title.' ntfy://:{my_token}@{mydomain}/birds
Which results in the output:
2024-08-28 19:30:12,138 - DEBUG - Loaded ntfy URL: ntfy://{mydomain}/birds?priority=default&mode=private&format=text&overflow=upstream&rto=4.0&cto=4.0&verify=yes
2024-08-28 19:30:12,139 - DEBUG - Using selector: EpollSelector
2024-08-28 19:30:12,140 - INFO - Notifying 1 service(s) asynchronously.
2024-08-28 19:30:12,142 - DEBUG - ntfy POST URL: http://{mydomain} (cert_verify=True)
2024-08-28 19:30:12,143 - DEBUG - ntfy Payload: {'topic': 'birds', 'title': 'Test Title', 'message': 'Test body of notification that is a bit longer than the title.'}
2024-08-28 19:30:12,143 - DEBUG - ntfy Headers: {'User-Agent': 'Apprise', 'Content-Type': 'application/json'}
2024-08-28 19:30:13,294 - INFO - Sent ntfy notification to 'http://{mydomain}'.
This does not result in a notification event from my server - nothing picked up by the server, nothing received by subscribed clients.
I notice that it lists http
instead of https
in this output. I'm not sure if this is relevant.
The following curl
command results in a successful notification:
curl -u :{my_token} -d 'test notification' https://{mydomain}/birds
Originally I was trying with the following apprise version:
~/BirdNET-Pi/birdnet/bin/apprise --version
Apprise v1.2.1
But upgraded to:
~/BirdNET-Pi/birdnet/bin/apprise --version
Apprise v1.8.1
Any help with further debugging routes would be greatly appreciated.
Kind regards,
Monty
Thank you for your response, and my apologies - I had initially followed the syntax on that page but forgot to include it in my attempts. It had the same result. Is there a reason the final line features {targets}
instead of {topics}
at the end like the others?
Here is a recent attempt:
~/BirdNET-Pi/birdnet/bin/apprise -vvv -b 'Test body of notification that is a bit longer than the title.' ntfy://{my_token}@{mydomain}/birds
2024-08-29 06:18:40,379 - DEBUG - Language set to en
2024-08-29 06:18:40,822 - DEBUG - Notification Plugin 108(s) and 154 Schema(s) loaded in 0.4294s
2024-08-29 06:18:40,824 - DEBUG - Loaded ntfy URL: ntfy://t...y@{mydomain}/birds?priority=default&mode=private&image=yes&auth=token&format=text&overflow=upstream&rto=4.0&cto=4.0&verify=yes
2024-08-29 06:18:40,825 - DEBUG - ntfy POST URL: http://{mydomain} (cert_verify=True)
2024-08-29 06:18:40,825 - DEBUG - ntfy Payload: {'topic': 'birds', 'message': 'Test body of notification that is a bit longer than the title.'}
2024-08-29 06:18:40,826 - DEBUG - ntfy Headers: {'User-Agent': 'Apprise', 'Authorization': 'Bearer {my_token}', 'Content-Type': 'application/json', 'X-Icon': 'https://github.com/caronc/apprise/raw/master/apprise/assets/themes/default/apprise-info-256x256.png'}
2024-08-29 06:18:41,963 - INFO - Sent ntfy notification to 'http://{mydomain}'.
No notification event triggered.
Again, successful curl
command run immediately afterwards (my reason for needing appraisal working is that it is built in to the BirdNET-Pi GUI)
curl -u :{my_token} -d 'test notification please ignore 3' https://{mydomain}/birds
{"id":"1uDb9jIrLBmo","time":1724883882,"expires":1724927082,"event":"message","topic":"birds","message":"test notification please ignore 3"}
Good news - I managed to get it working. When using the ntfys
protocol to specify https
a successful notification was triggered:
~/BirdNET-Pi/birdnet/bin/apprise -vvv -t 'Test Title' -b 'Test body' ntfys://{my_token}@{mydomain}/birds
2024-08-30 06:52:24,209 - DEBUG - Language set to en
2024-08-30 06:52:24,669 - DEBUG - Notification Plugin 108(s) and 154 Schema(s) loaded in 0.4449s
2024-08-30 06:52:24,671 - DEBUG - Loaded ntfy URL: ntfys://t...y@{mydomain}/birds?priority=default&mode=private&image=yes&auth=token&format=text&overflow=upstream&rto=4.0&cto=4.0&verify=yes
2024-08-30 06:52:24,673 - DEBUG - ntfy POST URL: https://{mydomain} (cert_verify=True)
2024-08-30 06:52:24,673 - DEBUG - ntfy Payload: {'topic': 'birds', 'title': 'Test Title', 'message': 'Test body'}
2024-08-30 06:52:24,673 - DEBUG - ntfy Headers: {'User-Agent': 'Apprise', 'Authorization': 'Bearer {my_token}', 'Content-Type': 'application/json', 'X-Icon': 'https://github.com/caronc/apprise/raw/master/apprise/assets/themes/default/apprise-info-256x256.png'}
2024-08-30 06:52:25,640 - INFO - Sent ntfy notification to 'https://{mydomain}'.
Unless https redirect is supposed to work or something consider this one closed 😊
Operator error/skill issue, whoops!
Great catch, I missed the https reference. Are you okay if i close this ticket?
Yes indeed, thanks again 😁