Send small messages and logs to yourself on telegram with no hassle
- Create a Telegram bot with BotFather and take note of the telegram bot token provided
- Node.JS
- NPM
Install from npm
npm i --save polylogger
or clone from this repo
git clone https://github.com/mullwar/telebot.git
cd polylogger
npm install
Import polylogger module and create a new connection object:
const Logger = require('polylogger');
const loggerBot = Logger({
botToken: 'j89efj983u893', // This is the token provided by BotFather
password: 'aStrongPassword' // This is the password you pass to the bot when subscribing for logs
});
// Sending info
loggerBot.sendInfo('Sending simple info from application');
// Sending error
loggerBot.sendError('Sending simple error from application');
- Go to your bot on telegram
- Send /echo to test if it's working. It should send back a message
- Send /auth yourPassword to subscribe to logs. yourPassword is the password string you passed to polylogger when initializing
- Telebot - Telegram bot library
PRs are welcome