Receive Push Notifications on Android without Google services
Find a file
jiriks74 cbb311a0a2
All checks were successful
Mirror to Forgejo / mirror-to-codeberg (push) Successful in 2s
fix(nix): Remove unnecessary package group, use python 3.11
2025-01-19 07:45:53 +01:00
.github/workflows chore: Add GitHub -> Forgejo mirror action 2025-01-15 01:43:59 +01:00
.editorconfig feat: Add editorconfig 2025-01-14 03:13:39 +01:00
.envrc chore: Set up Nix 2025-01-16 15:56:55 +01:00
.gitignore chore: Set up Nix 2025-01-16 15:56:55 +01:00
config-example.json feat: Implement monitoring heartbeat 2025-01-19 07:16:53 +01:00
default.nix fix(nix): Remove unnecessary package group, use python 3.11 2025-01-19 07:45:53 +01:00
LICENSE Initial commit 2025-01-13 22:06:09 +01:00
nextcloud2ntfy.py fix: Nested f strings don't work on Python < 3.12 2025-01-19 07:45:12 +01:00
README.md chore: Add requirements.txt 2025-01-15 01:13:22 +01:00
requirements.txt chore: Add requirements.txt 2025-01-15 01:13:22 +01:00

nextcloud2ntfy

Are you tired of Nextcloud still not supporting notifications F-Droid? After 4 years I sure am!

But you don't have to be because I solved it for you! Simply run this brigde, install install the ntfy app and you're done!

Features

  • 💻 Can be run on any machine with Python 3
  • 🌐 Support for both the official ntfy.sh and self-hosted instances
  • 🔒 Support for token authentication with ntfy
  • 🗑️ Dismiss button to remove the notification on Nextcloud too
  • 🛠️ Action buttons*

Note

* Action buttons currently open the browser instead of launching the correct app. I haven't found any mention of Nextcloud supporting app URLs (eg. twitter://)

Setup

0. Create a new application password for your Nextcloud account

This is better as if you leak you can easily remove it and no other passwords can be guessed from it.

Note

If your passwords can be guessed from knowing other passwords consider using a password manager and generated passwords...

1. On the machine running the bridge

  1. Grab a release
  2. Install the required Python modules: pip3 install -r requirements.txt
  3. Create a config file: cp config-example.json config.json
  4. Fill out the necessary values, they should be self-explanatory:
  • ntfy_topic
  • nextcloud_base_url
  • nextcloud_username
  • nextcloud_password
  1. Start the bridge: python3 nextcloud2ntfy.py -c config.json

Caution

On ntfy.sh (and instances with auth-default-access set to read-write) you need to set a secure topic id. It acts as your password so if anyone gets your topic id they can read all your notifications!

2. On your phone

  1. Install the ntfy.sh app
  2. Click the + button in the bottom right corner
  3. Input the topic you set in config.json

3. Profit

How did this happen?

I wanted to self-host ntfy so that I'd get better UnifiedPush experience than I had with the Nextcloud UnifiedPush Provider app. My Nextcloud instance shuts down for backups (generates a notification error in the app) and you have to set up redirects in order to get Matrix notifications working.

So I got ntfy working and I saw that the documentation has Integrations + community projects section.

Going through it I found this video: https://www.youtube.com/watch?v=0a6PpfN5PD8

It's about a script someone created to pull notifications from Nextcloud and push them to ntfy. I found it interesting but from a quick look at the script it was more limited than I'd like it to be. for example the notifications were immediately removed from Nextcloud which I didn't like.

As the script didn't have any license attached I decided to make my own from the ground up. Within 90 minutes I had a working prototype sending notifications to my phone.

From there I continued my work. First I created the Dismiss button. Then I noticed that ntfy can create action buttons so I parsed Nextcloud's notification buttons into something ntfy can understand.

In about 4-5 hour I had basically all the features finished. Hopefully I'll be able to add more (like opening the Nextcloud App instead of the browser) but we'll see what's possible.