Skip to content

Instantly share code, notes, and snippets.

@HirbodBehnam
Created May 11, 2026 13:38
Show Gist options
  • Select an option

  • Save HirbodBehnam/cc310c25d78d8c33cfe8afbd185a7ed2 to your computer and use it in GitHub Desktop.

Select an option

Save HirbodBehnam/cc310c25d78d8c33cfe8afbd185a7ed2 to your computer and use it in GitHub Desktop.
A short guide on how to setup local push notification service for a self-hosted matrix server.

Matrix Push Notification With ntfy

A short guide to teach you how to setup Matrix push notification service using ntfy in air gapped environment. This guide is divided by the programs you should run and configure. There is a assumption that you have already setup an synapse server.

ntfy

To setup ntfy, you need to create a configuration file named /etc/ntfy/server.yml and place this inside it:

base-url: "https://ntfy.example.com"
behind-proxy: true # only set true if you are behind nginx or caddy
cache-file: "/data/cache.db"

Run ntfy with this command:

docker run -d --name ntfy --mount type=volume,src=ntfy-data,dst=/data -v /etc/ntfy/server.yml:/etc/ntfy/server.yml --restart=unless-stopped -p 127.0.0.1:12345:80 -it binwiederhier/ntfy:v2.22 serve

If you are behind Caddy or Nginx, remember to setup a reverse proxy to 127.0.0.1:12345.

Synapse

If both ntfy and synapse server are on the same private node, I suggest you manually resolve the address of the ntfy server in synapse container. This can be done by adding --add-host "ntfy.example.com:192.168.1.10" to synapse docker run arguments. Additionally, if ntfy is on a private address, you should whitelist the address by adding this to your homeserver configuration file of Synapse:

ip_range_whitelist:
  - 192.168.1.10

Client

For Android, you need to install Element X and ntfy programs from Google Play or Fdroid. I couldn't get FluffyChat to work. At first, install ntfy and register your home server in the settings (Default server). Next, disable battery optimizations for both Element X and ntfy. In settings of Element X, under Notifications, you should set the notifications provider to ntfy instead of firebase. That should register the service and you'll now be able to receive notifications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment