a1-notify
v2.1.0
Published
Utils for notification events (sms, email, local beep...). Useful to send alarms.
Downloads
7
Readme
a1-notify
Use different techniques to notify an event (alarm, trigger).
Available methods: beep, email, web push notification, sms to phone.
Email special case
Tested from gmail to gmail and to outlook.
https://nodemailer.com/about/
https://support.google.com/accounts/answer/185833?hl=en
Steps:
- enable 2fa in the account
- create an app password
Usage
Typescript is also available
No configuration required.
import * as notify from 'a1-notify'
notify.beep()
API
- beep(): Beep sound in the current computer.
- async rest(url, message): Send an HTTP POST message.
- async push(url, message, token?): Send a web push notification. Token is optional for restricted push messages.
- async email(to, subject, message): Send an email message. process.env.EMAIL_USER and process.env.EMAIL_APP_PW must be set before sending. Message can be either text or html.
- async sms(phone, message): Send an SMS (requires AWS account and whitelisted or arbitrary SMS must be selected in the AWS console).
- async popup(title,message): Display a desktop GNOME popup notification.