Simple Telegram notification service for Node.js with retry and proxy support.
Send messages and documents.
const Telegram = require('telegram-notify');
let telegram = new Telegram({token:'tokenString', chatId:'id'});
await telegram.send('alert');
const fileBuffer = fs.readFileSync('file.txt');
const file = new Blob([fileBuffer], {type: 'text/plain'});
await telegram.sendDocument(file, 'file.txt', 'text of message');
To use the library, install it through npm
npm install --save telegram-notifytoken- your telegram bot token, create bot: https://t.me/BotFatherchatId- telegram chat id to recive the notify, get the id: https://t.me/Getmyid_Work_Botproxy[optional] - telegram proxy string, e.q. http://login:password@ip:portmaxErrors[optional] - maximum number of attempts to send a Telegram message (default:5)timeout[optional] - maximum time to wait for a response from Telegram in milliseconds (default:3000)
send- send a telegram messagesendDocument- send a file via telegramanswerInlineQuery- sets the result of an inline query