10 ms·
Show HN: A tool to send push notifications to your phone, written in Go
- binwiederhier 5y agoHey folks, I've been working on this for a couple of months. It's a tool and service that lets you send push notifications to your (Android) phone via simple PUT/POST requests, like so: curl -d "hi there" ntfy.sh/mytopic It's open source and easily self-hostable. It has tons of features (though I'm still working on many), and there's also an Android app. I'd love some feedback, and I'd love it even more if you started using it. I'm doing this for funsies, but I'm also running it as a real service/project, with uptime monitoring and all that.
- mikecoles 5y agoHello Philipp, what benefits do you think make the app shine against something like Gotify? It looks like you have integrated with firebase. What else should I be looking for? The firebase path looks interesting for my 'toy' messages so save some battery life. https://gotify.net/ https://gotify.net/
- binwiederhier 5y agoHowdy, I didn't know Gotify existed when I started writing ntfy, so it's in a sense very similar because it makes sense this way. ntfy is open by default, meaning no need to create accounts or set up anything. You can use it without having to remember a token or anything. That means you can use it easily on servers where you cannot install anything, e.g. at work. It's also a pub-sub system and not just a notification system, so you can do stuff like collect data from multiple machines super easily with multiple publishers and one subscriber [1], and whatever else you can think of. In terms of features, I'm lagging behind a little on some things (images, nice web UI) but I'm ahead on others (scheduled messages, tags/emojis, webhooks support, email notifications, publish via email, see more [2]). I've also got a CLI that can run commands on incoming messages which is pretty neat (see [3]). Plus, i think the docs are pretty neat too. I suggest you give it a go and tell me what you think. It's pretty easy to install the app and uninstall if you don't like it. Here's a summary from a while ago too [4]. [1] https://ntfy.sh/docs/examples/#collect-data-from-multiple-machines https://ntfy.sh/docs/examples/#collect-data-from-multiple-ma... [2] https://ntfy.sh/docs/publish/ https://ntfy.sh/docs/publish/ [3] https://ntfy.sh/docs/subscribe/cli/ https://ntfy.sh/docs/subscribe/cli/ [4] https://www.reddit.com/r/selfhosted/comments/qxlsm9/my_open_source_notification_android_app_and/hm31nff/ https://www.reddit.com/r/selfhosted/comments/qxlsm9/my_open_...
- spurgu 5y agoYeah I just saw your rsync example above and it's indeed a very nice feature, to not have authentication, because at those times that I would need this I would certainly not feel up to hassling with installing/setting up Gotify (I do have a Gotify server running though). I shall setup and play with this, thanks! Edit: It was exactly for things like `bash long-running-script.sh ; notify "done"` that I installed Gotify in the first place, but I've never actually used it like that. This I surely will!
- binwiederhier 5y agoHurray. I acquired a user. :-) Let me know if you have any questions or problems. I am usually pretty quick to react. You can leave questions in GitHub issues [1] or in Discord [2]. Also, there are a few more examples here [3] [1] https://github.com/binwiederhier/ntfy/issues https://github.com/binwiederhier/ntfy/issues [2] https://discord.gg/cT7ECsZj9w https://discord.gg/cT7ECsZj9w [3] https://ntfy.sh/docs/examples/ https://ntfy.sh/docs/examples/
- karmanyaahm 5y ago> It looks like you have integrated with firebase Unfortunately, Firebase requires Google services. UnifiedPush integration would be nice
- binwiederhier 5y ago1. The F-Droid flavor of the app [1] does not require or use Firebase. And: If you self-host the server and use the Google Play flavor [2] of the app, it won't use Firebase either. 2. I've just started work [3] on making ntfy a UnifiedPush (https://unifiedpush.org https://unifiedpush.org) distributor, meaning that other apps/services will be able to use ntfy.sh (or a self-hosted server) as a means to deliver notifications or messages. I'm super excited about this, and I don't think it'll take very long. [1] https://f-droid.org/en/packages/io.heckel.ntfy/ https://f-droid.org/en/packages/io.heckel.ntfy/ [2] https://play.google.com/store/apps/details?id=io.heckel.ntfy https://play.google.com/store/apps/details?id=io.heckel.ntfy [3] https://github.com/binwiederhier/ntfy/issues/9 https://github.com/binwiederhier/ntfy/issues/9
- resonator 5y agoI look forward to that. I wouldn't try it without unified push but if you add that, it could be easily be better than gotify which really only provides the bare minimum.
- stavros 5y agoHmm, I'm not very well versed in Android push messaging, but how does your self-hosted binary send notifications? Don't you need to include GCM keys somewhere?
- binwiederhier 5y agoIf you self-host, FCM is not involved at all. The app will run a foreground service which keeps a connection to your selfhosted server open. I detailed it a bit more here with links to the docs: https://news.ycombinator.com/item?id=29719493 https://news.ycombinator.com/item?id=29719493 Edit: If you want to use FCM for your selfhosted server, you can, but you have to build your own .APK file. Instructions are here: https://ntfy.sh/docs/develop/#android-app https://ntfy.sh/docs/develop/#android-app
- deleted 5y ago[deleted]
- vladharbuz 5y agoI'm very curious if anyone knows of any software that does the opposite, i.e. running an arbitrary command on my computer when I tap a button on my phone.
- rwky 5y agoKDE Connect can do that if you happen to be using KDE as a desktop environment and an android phone https://userbase.kde.org/KDE_Connect/Tutorials/Useful_commands https://userbase.kde.org/KDE_Connect/Tutorials/Useful_comman...
- makeworld 5y agoYou don't need to be using KDE. Just have KDE Connect installed.
- Debug_Overload 5y agoKDE isn't mandatory. Some distros (like ZorinOS) also have this functionality by default.
- binwiederhier 5y agoYou can do this with a combination of ntfy and MacroDroid [1] or Tasker. With those apps, you can do things like "if I shake my phone, publish this message to this HTTP endpoint". And then you can subscribe to a ntfy topic via the ntfy CLI and execute a command. Here's how you do it: 1. Install MacroDroid [1] on your phone 2. Set up an action in MacroDroid to publish a message to a ntfy topic via a HTTP GET (see [2]) 3. On your computer, install the ntfy CLI and set up the ntfy-client systemd service (or use `ntfy subscribe mytopic 'echo $m'` or something similar); see instructions here: [3] Here are some screenshots/videos of how to integrate MacroDroid and Tasker with ntfy [4]. Please note that the MacroDroid notes are a little out of date, since you can now use HTTP GET to publish messages, so you don't need to use the "Send intent" thing anymore, which means you don't need the ntfy app on your phone. If you need more help, you can find me on Discord [4] and I'll help out. [1] https://play.google.com/store/apps/details?id=com.arlosoft.macrodroid https://play.google.com/store/apps/details?id=com.arlosoft.m... [2] https://ntfy.sh/docs/publish/#webhooks-send-via-get https://ntfy.sh/docs/publish/#webhooks-send-via-get [3] https://ntfy.sh/docs/subscribe/cli/#subscribe-to-multiple-topics https://ntfy.sh/docs/subscribe/cli/#subscribe-to-multiple-to... [4] https://ntfy.sh/docs/subscribe/phone/#integrations https://ntfy.sh/docs/subscribe/phone/#integrations [5] https://discord.gg/cT7ECsZj9w https://discord.gg/cT7ECsZj9w
- alvarlagerlof 5y agoThis would use FCM controlled by you, correct?
- binwiederhier 5y agoIn the Google Play flavor [1] and with ntfy.sh, yes. If you use a selfhosted server or use the F-Droid flavor [2], then no. In those cases a foreground service with a persistent connection is used. You can find more info on the configuration page for a self hosted server [3]. You may want to check out this question in the FAQ too [4] You can also turn off publishing to FCM for ntfy.sh on a per-message by message basis [5]. [1] https://play.google.com/store/apps/details?id=io.heckel.ntfy https://play.google.com/store/apps/details?id=io.heckel.ntfy [2] https://f-droid.org/en/packages/io.heckel.ntfy/ https://f-droid.org/en/packages/io.heckel.ntfy/ [3] https://ntfy.sh/docs/config/#firebase-fcm https://ntfy.sh/docs/config/#firebase-fcm [4] https://ntfy.sh/docs/faq/#why-is-firebase-used https://ntfy.sh/docs/faq/#why-is-firebase-used [5] https://ntfy.sh/docs/publish/#disable-firebase https://ntfy.sh/docs/publish/#disable-firebase
- rsync 5y agoWhat is the advantage of sending a push notification as opposed to a SMS alert ? My alerting regime is also built on 'curl' commands that generate SMS via twilio. For example: curl -s -X POST -d "Body=$msg" -d "From=$from" -d "To=$to" "https://api.twilio.com/2010-04-01/Accounts/$accountsid/Messages" -u "$accountsid:$authtoken" ... and I am very happy with the ability to send SMS with both a configurable from and to number. However I am interested and open-minded - what are the benefits of using a push notification ?
- binwiederhier 5y agoFirst of all, I love your username. Are you affiliated with the rsync tool or just an rsync lover like me? If you are, I bow my head to you and thank you. :-D If you are happy with SMS and twilio, then use it. Having many options is generally always awesome. The main reason I made ntfy was because I mumbo jumbo (that's a technically term) on all sorts of servers for work and for fun, and I often do things in a tmux or screen that take forever, like rsync something (ha!) or reseed a MySQL replica. On many of those servers, I cannot or should not install anything, and I certainly don't want to leave an auth token in the bash history. For those use cases, having a short command to ping me when something is done is FREAKING AWESOME. This has become muscle memory to me by now: rsync -av bla root@myserver:/bla; curl -d "rsync done" ntfy.sh/philalerts No auth token. No looong string of things. Just a simple curl. But again. If you're happy with SMS+twilio, then there's no reason to switch. Though I would love it if you could give it a shot.
- icelancer 5y agoHe is the rsync.
- binwiederhier 5y agoOh my, I'm star struck. I've used rsync, written a about rsync (in my master thesis) and looked at rsync code a long time ago. Amazing :-D
- 5y ago
- runjake 5y agoThere is a similar app, created by jcs, at pushover.net for mobile and desktop. It does require signup, though.
- eximius 5y agoSo, no authentication is billed as a feature, but just means you might get spam notifications?
- binwiederhier 5y agoIf you choose "mytopic" as a topic, yes. If you choose "eximius-1", probably not. If you are paranoid, you can choose "ZfxdjfdkAFHFJKL" and then you have an "auth token". That said, auth is on the list of things to add. It'll be optional and I will try to make it simple. There's a ticket for it here [1] [1] https://github.com/binwiederhier/ntfy/issues/19 https://github.com/binwiederhier/ntfy/issues/19
- frays 5y agoWhat's stopping someone from writing a program that iterates through all of the different ntfy topics with spam messages? e.g. curl -d "Visit my site spammer.com for your chance to win $100" ntfy.sh/{phil_alerts,controversial,topic3,topic4, etc...}
- binwiederhier 5y agoDo it and you shall find out :-) I have pretty rigorous rate limiting based on IP address [1]. If you have lots of IP addresses at your disposal, I may have a problem. So far it's been fine. [1] https://ntfy.sh/docs/publish/#limitations https://ntfy.sh/docs/publish/#limitations
- babyshake 5y agoI would probably just use Slack and Slack-bots for a low-code approach to this. Are there major downsides? I don't believe you would need to pay for Slack to use primarily for up to a few dozen Slackbot messages per day.
- binwiederhier 5y agoAs I've said in another comment [1], if you're happy with what you have then by all means stick to it. I think the major upside of ntfy (aside from the bagillion features of course) is that it's so FREAKING EASY, and that it doesn't have auth. You probably don't remember your Slack auth token by heart. With ntfy, you can do: ./backup-server.sh; curl -d "backup done" ntfy.sh/shake_backups [1] https://news.ycombinator.com/item?id=29719738 https://news.ycombinator.com/item?id=29719738
- patleeman 5y agoI found that telegram works pretty well to get notifications from my personal server. Its pretty easy to set up a channel and bot.
- fragmede 5y agoThe major downside I see is you have to use Slack for that. If you're already in that ecosystem it's fine, though their notifications preferences could use a bit more configurability.
- lijogdfljk 5y agoI was wanting something like this recently, but specifically to send notifications and notifications-with-images to my watch. Bonus points if i can choose the icon the latest iOS has next to it. Anyone familiar with something to achieve this? Preferably self hosted
- stavros 5y agoThe best thing I found was a Telegram bot, but that's not secure. Unfortunately, nothing I've seen is, because Google will see your notification text for GCM anyway.
- betterthanlast 5y agoI make a curl request to IFTTT and include an image url (in my case green checkmark or red X). Good: it took virtually no time to set up and it’s been running for years and years. Bad: everything gets the IFTTT logo.
- jedberg 5y agoI wish Apple itself had a service like this. Make it part of iCloud. Give me a URL and a token so I can just send a push notification to my phone without an app. Make it part of the OS.
- codetrotter 5y agoIf they did that then scammers would coax people into giving them access to the push token and the victims would be receiving spam notifications that would be very hard for them to get rid of. We already see that kind of stuff with spam calendars. I don’t see Apple enabling such kind of push notifications. What kind of use cases do you have in mind?
- jedberg 5y ago> If they did that then scammers would coax people into giving them access to the push token Since it would still go through apple servers, they could put mitigations in place, such as checking for repeated messages to multiple accounts, one IP pushing to multiple accounts, the actual content of the message, etc. They could also put an interface right on the phone that lets you mark it as spam. They could also give you an easy way to rotate the key. > What kind of use cases do you have in mind? - Set up a cron to trigger an push when I know we need to leave the house. - Set up a cron to trigger a push at 7pm to all the phones in the house to remind the kids to come to dinner (and remind me it is dinner time). - Use a weather API and the Nest API to determine when it is time to open or close the window and push that. - Use my cameras to determine when the postman has arrived and then push that the mail has arrived. - Basically any useful household information that can be gathered via API and pushed without anyone having to ask for it.
- arusahni 5y agoIs this related to the other similarly-purposed ntfy [1]? Previous discussions here [2]. [1] https://github.com/dschep/ntfy https://github.com/dschep/ntfy [2] https://news.ycombinator.com/item?id=12370702 https://news.ycombinator.com/item?id=12370702
- binwiederhier 5y agoSadly no. I picked the name and bought the domain before I found out about it. When I found out I created a PR [1] to integrate the two. It's not been merged though. Given that I bought the domain and all that I'm kinda sticking with the name though. [1] https://github.com/dschep/ntfy/pull/234 https://github.com/dschep/ntfy/pull/234
- marderfarker2 5y ago
- altilunium 5y agoBack then, i want to receive a notification directly to my phone whenever "an event" happened on my server. So, i did this : 1. Create a Telegram bot by using BotFather (/newbot), get its HTTP API access token. 2. Invite that bot to a group, make it as a administrator. 3. Invite @RawDataBot to that group. It will tell the group's chat_id. 4. Done. If we want to trigger the notification, just send HTTP GET to https :// api.telegram.org/botBOTTOKEN/sendMessage?chat_id=CHATID&text=URLENCODEDTEXT . Replace BOTTOKEN with your bot's HTTP API access token , CHATID with the group's chat_id, and URLENCODEDTEXT with the notification text body (url encoded). Thank you for making this open source. At least, by using this, now i can self-host everything without having to rely to Telegram anymore.
- Abishek_Muthian 5y agoIf you're on android you can also use MQTT Client[1] and Tasker[2] to receive MQTT messages and further process it the way you like. You need a MQTT broker, Any RPi could serve as one. P.S. Congratulations on the launch OP, I've been looking at gotify for a while and would try to use yours when the need arises. [1] https://play.google.com/store/apps/details?id=in.dc297.mqttclpro https://play.google.com/store/apps/details?id=in.dc297.mqttc... [2] https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm https://play.google.com/store/apps/details?id=net.dinglisch....
- sneak 5y agoBe advised: this shares all of your notification texts with the Telegram server operators (Telegram is not end to end encrypted). The software in TFA can be self-hosted, for privacy.
- hansel_der 5y agoafaik all push notifications are only transport encrypted and hence can be seen in clear by either google or apple
- Oranguru 5y agoJust a few days ago I wanted to set up a service that would allow me to receive notifications on my mobile phone that would alert me when the very long processes that I neeed to leave running at work unexpectedly crash, saving me from the burden of having to monitor them continuously. I was reading some guides to understand how to configure Firebase and deploy all the the necessary parts on an Azure server. But now, thanks to this, I can get everything up and running in a matter of a few minutes. You have saved me a lot of time. Not to mention the ability to easily integrate it with the other command line tools I often use. This is huge. Thank you so much for this, I'm going to get a lot out of it.
- binwiederhier 5y agoThank you ;-) Comments like this make my day. If you like it, consider reviewing or rating it on Google Play too ;-)
- carlivar 5y agoWhat happens if multiple phones are subscribed to the same topic?
- binwiederhier 5y agoIt's true pub sub. They both get the message. It's a feature, not a bug ;-)
- geocrasher 5y agoThis is just what I have been needing ever since Notify17 shut down. Thank you! I'm using your server for now but will be self hosting it soon. Use case: basic server monitoring.
- binwiederhier 5y agoHurray, another user ;-) Let me know via Discord or GitHub if there are any issues or desires.
- geocrasher 5y agoI surely will! I also saw there's an RPM for it, so that makes adoption that much easier. I really, really, really dislike having to re-compile to update things. It just never happens lol.
- binwiederhier 5y agoI've never tested the rpm, since it's just built by GoReleaser, but it should be straight forward and just work. Let me know if you run into issues.
- tannercollin 5y agoNice work, Philipp! I wrote something similar at: https://notica.us https://notica.us I didn't write an app, however. I rely on the browser notification API which doesn't have the best support on mobile unfortunately. It works great on desktop. My inspiration was the same though. I do most of my work over ssh, and wanted a local desktop notification when a slow command was finished running.
- binwiederhier 5y agoNice. Indeed quite similar. Great minds think alike hehe. All of your examples include a "!", which is a special character in bash. Sure that works without quoting?
- hansel_der 5y agoto save you the trouble of finding out for your self: yes, it works (! is not that special)
- binwiederhier 5y agoI eventually have to figure out what ! does. In my she'll it always leads to errors about some events and whatnot. I shall Google and find out ;-)
- binwiederhier 5y agoOh wow ! is quite powerful. Some of these bang commands are quite questionable, but hey... Like !12 runs the 12th command from the bash history. That's seems super dangerous to me.
- tannercollin 5y agoHere's a good collection of tricks like that: https://github.com/jlevy/the-art-of-command-line https://github.com/jlevy/the-art-of-command-line
- lydericlandry 5y agoThis is very good. Very easy to use and self-host! Many thanks and kudos for your excellent documentation. I run it in an LXD container and I use Caddy as proxy (for Let's Encrypt HTTPS). It works very well. Happy to provide details if someone is interested.
- binwiederhier 5y agoThank you for the feedback. Always makes my day. ;-) If you think this is a good setup and many people will run it like that, we could add it to the docs as an example on the install page: https://ntfy.sh/docs/install/ https://ntfy.sh/docs/install/
- iLoveOncall 5y agoPlease don't write "Android/iOS" if iOS is not supported.
- binwiederhier 5y agoI felt bad about that one ;-) It's on purpose to grab the attention of Mac folks to solicit help. But you're right it's not very kind. I'll change the wording.
- severine 5y agoBest docs ever, really nfty!
- binwiederhier 5y agoThanks, that's what I was going for, hehe. I was inspired by the docs of the fantastically awesome GoReleaser [1] tool, so half the credit goes to them :-D [1] https://goreleaser.com/ https://goreleaser.com/
- st3fan 5y agoI wrote a similar thing but then to send messages directly to you AppleWatch. See https://astronote.app https://astronote.app
- binwiederhier 5y agoVery cool. Its not by any chance open source, right? Does it work with FCM?
- sickmartian 5y agoCongratulations on the launch! It looks very useful and easy to use as well
- binwiederhier 5y agothank you. ;-)
- deleted 5y ago[deleted]
- kottaram 5y agoIf you had written this a year ago, we would have used this for our project. We wrote the same thing from scratch.
- Threeve303 5y agoI was just thinking how I need more notifications
- sgarland 5y agoThis is lovely, thank you. I've got a self-hosted server in Docker now, and have implemented some alerts. FWIW for anyone else, 1Pass or similar can easily create a four short words style password that's DNS compliant.
- binwiederhier 5y agoAppreciate the kind words. Let me know on GitHub or Discord if you have any problems.