System notifier sending Telegram message and SMS.
Installation
npm install system-notifier
Usage
const SystemNotifier = ;/** Or with ES6+ */; const notifier = prefix: 'domain.com' telegram: botToken: processenvTELEGRAM_BOT_TOKEN chatId: processenvTELEGRAM_CHAT_ID twilio: authToken: processenvTWILIO_AUTH_TOKEN accountSID: processenvTWILIO_ACCOUNT_SID fromNumber: processenvTWILIO_FROM_NUMBER toNumber: processenvTWILIO_TO_NUMBER
Then, call notifier.notify
function with your message:
notifier;
You can add an emoji prefix with one of the following codes: info
(ℹ️), error
(❌), warning
(⚠️) or success
(✅).
notifier;
Build
npm run build
Testing
Create a .env
file and add your providers credentials:
TELEGRAM_BOT_TOKEN=TELEGRAM_CHAT_ID=TWILIO_AUTH_TOKEN=TWILIO_ACCOUNT_SID=TWILIO_FROM_NUMBER=TWILIO_TO_NUMBER=
npm test
Related
- twilio-node - A Twilio helper library
License
This project is licensed under the MIT license.