Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Sending notifications programmatically: let me count the ways (trickster.dev)
101 points by rl1987 on March 9, 2022 | hide | past | favorite | 19 comments


I like Apprise, one single Python library / CLI tool, to send notifications via a lot of services: https://github.com/caronc/apprise


this is exactly what I came to the comments to look for - I want to be able to integrate against one API and let that handle the onwards notifications. thanks!


Handy examples. If you need flexibility with regards to output channels, Apprise is undoubtedly a good choice. There are also dedicated projects such as https://ntfy.sh/ and https://gotify.net/ (both self-hostable).

If you have XMPP, you can also send notifications to XMPP directly via sendxmpp (of which there are actually many incarnations: https://wiki.xmpp.org/web/User:MDosch/Sendxmpp_incarnations ) or via a webhook/HTTP API such as https://slickmsg.com/


Eyyy, that's my project. Hurray. Thanks for mentioning it.


Hi, it's only a small thing, but E.164 format does not include the +. If it includes the plus then it is E.123 format. The Twilio page explaining E.164 formatting is wrong.


Care to elaborate? I've recently had to research E.164 and haven't come across this being mentioned. In fact I remember more sources claiming that the plus-sign is a required part of the format


Yes sure! E.164 is the international standard as set by the ITU. Its a bit like an RFC. The original can be found in English here: https://www.itu.int/rec/T-REC-E.164-201011-I/en

The normal public telephone numbers we use are "International ITU-T E.164-number for geographic areas" and all E.164 numbers consist of the digit 0 to 9 only and no other characters. Spaces, symbols prefixes or suffixes do not form part of the number.

Section 12 explains that when a local code should be called in order to make an international call (e.g. dialling 00 from the UK or 011 from the USA) then E.123 suggests using the symbol + before the E.164 number. This symbol can be used when displaying the number to a human so the human can understand that they should replace the + with their local code to call internationally.

There's also a bit in section B.7 which describes CLIs and denotes that a CLI Should only be "the full international ITU-T E.164-number, i.e., country code (CC), national destination code (NDC) and subscriber number (SN). No other information, such as prefixes or symbols (e.g., "+"), should be included"


Great article. All of this complexity is the reason I started Courier (YC S19) [0], which we just launched on HN [1] a few days ago. :-)

We take the approach of essentially offering an abstraction layer that lets you route to one or more channels based on data related to the notification event instead of having to hardcode the integration at the callsite. This has the added benefit of also letting you pull the template abstraction into the same space (so you don't go crazy manually maintaining HTML templates for email, plain text for SMS, BlockKit for Slack, etc. etc.)

FYI we support integrations for nearly all of the channels mentioned here: email (via SMTP, SendGrid, SES, and others), Discord, SMS (via Twilio and others), web push, WhatsApp (via Twilio WhatsApp), Slack, & PagerDuty. And many others...

[0]: https://www.courier.com/

[1]: https://news.ycombinator.com/item?id=30527757


Send to the Prometheus alertmanager and utilise the provided notification channels.

Then when you wish to reconfigure the channels you use for different notifications you can do so in a zero code way.

Alertmanager is available in Grafana Cloud as part of the alerting stack that is standard, so if you're using Grafana Cloud you already have Alertmanager. Alternatively it's free with Prometheus.


I've historically used mailjet's api for automating the sending of little emails to myself for my own personal stuff...But lately have only been using matrix. In essence i have a private room with myself and a bot, and simply send matrix messages to that room. Its pretty quick and easy, and i can access the messages from any matriux app/client anywhere that i have internet connection...and since matrix is like email in that it is federated...i'm theoretically not as impacted by cloud Saas outages...unless of course my own matrix homeserver gets hit...but then again, this is only for my personal stuff.


Tangentially, I recently used mouse emulation on a timer to manipulate Firefox into sending a push notification with a URL to a mobile device for a partially faked out internal demo.


I'm using the Pushover app for this. Very easy to interface with. You can even send images.


In addition to what's mentioned here, if you don't need to read any data back to your application, you can just generate a webhook url for a discord server and send json messages there. It's very easy to set up if you just want to keep yourself informed about what's going on.

If I remember right it's the same message object format as the full api, the only real limitation is that it's oneway only communication.


telegram messaging is the same. You can send a message to a group or individual with a simple get request to a URL.

That URL is: ttps://api.telegram.org/bot[bot_id]/sendMessage?chat_id=[chat_id]&parse_mode=Markdown&text=[message_contents]

Get the bot_id by sending "/newbot" to a telegram user named botfather.

Get the chat_id as described here: https://stackoverflow.com/questions/32423837


In the past, I always used my carrier's email-to-sms bridge.

https://www.lifewire.com/sms-gateway-from-email-to-sms-text-...


It is good for that purpose if you are the recipient and know what is your carrier. But multiple recipients, not so much.


Good point.


This is typically very slow (minutes) and they can be dropped silently.


If you are building an app just for yourself, or a small team. you can leverage our product MagicBell (https://www.magicbell.com), and get in-app, push, text, and Slack notifications in one API call.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: