Motivation: Have a local api to send text alerts. If you write a script on the fly and need notification capabilities, leverage this local alert server.
- Clone Repo
- Run npm install
- Set your .env vars to configure the app (there's a sample called .env.sample)
- Run npm start
RECIPIENT_LIST=emailAddress1,emailAddress2,...emailAddressN
MAIL_USER=smtp-user-name
MAIL_PASS=smtp-password
MAIL_HOST=smtp-host
MAIL_PORT=smtp-host
MAIL_FROM=email-address
ALLOW_LIST=ipaddress1,ipaddress2,...ipaddressN
You can use email to send SMS messages by adding a phone number in the format 5555555@{Your ProviderSMSGateway}
If you don't have your own smtp server, you can use a service like sendgrid. I use them since they have a free tier
Add your IP to the ALLOW_LIST variable, and send a post request to the server (default port 9090) with the json data
{"subject": "Some subject", "text": "Some text"}
Ex: curl -X POST -H "Content-Type: application/json" -d '{"subject": "Test Text", "text": "Hello World!"}' http://localhost:9090