https://github.com/dimitrinicolas/system-notifier
System notifier sending Telegram message and SMS (using Twilio API)
https://github.com/dimitrinicolas/system-notifier
Last synced: 8 months ago
JSON representation
System notifier sending Telegram message and SMS (using Twilio API)
- Host: GitHub
- URL: https://github.com/dimitrinicolas/system-notifier
- Owner: dimitrinicolas
- License: mit
- Created: 2019-02-07T18:17:03.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-09T13:57:19.000Z (over 7 years ago)
- Last Synced: 2025-10-07T15:59:18.662Z (8 months ago)
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/system-notifier
- Size: 76.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# system-notifier [![Build Status][ci badge]][ci link] [![Coverage Status][coverage badge]][coverage link]
System notifier sending Telegram message and SMS.
## Installation
```bash
npm install system-notifier
```
## Usage
```javascript
const SystemNotifier = require('system-notifier');
/** Or with ES6+ */
import SystemNotifier from 'system-notifier';
const notifier = new SystemNotifier({
prefix: 'domain.com',
telegram: {
botToken: process.env.TELEGRAM_BOT_TOKEN,
chatId: process.env.TELEGRAM_CHAT_ID
},
twilio: {
authToken: process.env.TWILIO_AUTH_TOKEN,
accountSID: process.env.TWILIO_ACCOUNT_SID,
fromNumber: process.env.TWILIO_FROM_NUMBER,
toNumber: process.env.TWILIO_TO_NUMBER
}
})
```
Then, call `notifier.notify` function with your message:
```javascript
notifier.notify('Internal Server Error...');
```
You can add an emoji prefix with one of the following codes: `info` (ℹ️), `error` (❌), `warning` (⚠️) or `success` (✅).
```javascript
notifier.notify('Internal Server Error...', 'error');
```
## Build
```bash
npm run build
```
## Testing
Create a `.env` file and add your providers credentials:
```dosini
TELEGRAM_BOT_TOKEN=
TELEGRAM_CHAT_ID=
TWILIO_AUTH_TOKEN=
TWILIO_ACCOUNT_SID=
TWILIO_FROM_NUMBER=
TWILIO_TO_NUMBER=
```
```bash
npm test
```
## Related
- [twilio-node][twilio-node] - A Twilio helper library
## License
This project is licensed under the [MIT license](LICENSE).
[ci badge]: https://travis-ci.org/dimitrinicolas/system-notifier.svg?branch=master
[ci link]: https://travis-ci.org/dimitrinicolas/system-notifier
[coverage badge]: https://coveralls.io/repos/github/dimitrinicolas/system-notifier/badge.svg?branch=master
[coverage link]: https://coveralls.io/github/dimitrinicolas/system-notifier?branch=master
[twilio-node]: https://github.com/twilio/twilio-node