Clone repository & install dependencies
git clone https://github.com/ruziev-dev/near-node-tg-bot.git
cd near-node-tg-bot
npm i
Make your config.env
file by example .env
cp .env config.env
Set your settings to config.env
nano config.env
# set your values
TG_API_KEY=""
TG_CHAT_ID=""
NODE_RPC="127.0.0.1:3030"
POOL_ID="xxx.poolv1.near"
- TG_API_KEY - you can get from @BotFather
- TG_CHAT_ID - you can by using @GetIDs Bot
node index.js
After first running you will get the first message to you Telegram messenger and current state will be saved to .prev_state.json
If you want to test again you have to remove state file.
rm .prev_state.json
which node
# use this path to in crontask
> /usr/bin/node
Add chron task every minute
crontab -e
Add this row with setting path to Node.js and script
# set your path
*/1 * * * * cd /home/<USERNAME>/near-node-tg-bot/ && /usr/bin/node index.js > /dev/null 2>&1
Reload cron service to start execute script
sudo service cron reload
Examples of notifications you can see below:
- When there is some connection error or neard had stopped
- When uptime lower 80% and goes down
- When new epoch was started