This guide explains how to set up a notification server using ntfy.sh
to send notifications
across web and mobile devices (Android/iOS). It will be
broadcast to all synced devices under the mytopic
section.

Installing ntfy.sh
To install ntfy.sh
on a Raspberry Pi running
Debian/Ubuntu, follow these steps:
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://archive.heckel.io/apt/pubkey.txt | sudo gpg --dearmor -o /etc/apt/keyrings/archive.heckel.io.gpg
sudo apt install apt-transport-https
sudo sh -c "echo 'deb [arch=armhf signed-by=/etc/apt/keyrings/archive.heckel.io.gpg] https://archive.heckel.io/apt debian main' > /etc/apt/sources.list.d/archive.heckel.io.list"
sudo apt update
sudo apt install ntfy
sudo systemctl enable ntfy
sudo systemctl start ntfy
The last two lines ensure that ntfy
automatically
restarts if the Raspberry Pi reboots.
Configuring the Server
Since port 80
is already in use, change the
ntfy.sh
server to listen on port 83
:
sudo vim /etc/ntfy/server.yml
Modify the configuration:
listen-http: ":83"
Restart the server for the changes to take effect:
sudo systemctl start ntfy
systemctl status ntfy

Exposing Port 83
If the server is hosted at home, expose port 83
on your
router for public access. If needed, configure port forwarding for
80
in your router settings.
Testing Notifications
Send test notifications from the local server and the internet:
curl -d "Hi" 192.168.1.25:83/mytopic
curl -d "Hi from Internet" local.anibalcopitan.com:83/mytopic




Security Considerations
For secure access and notification generation, enable
auth-file
in the configuration.
🎥 Watch the Demo in Action!
Here’s a quick demo showing how ntfy.sh sends a notification when a user subscribes with their email. The video is in Spanish, but you can follow the process visually.
Conclusion
Setting up a broadcast notification system with ntfy.sh
is straightforward and efficient. It enables fast integration via HTTP,
making it a powerful tool for real-time notifications across multiple
devices.
No hay comentarios:
Publicar un comentario