@garydu/tg-notify
v0.1.1
Published
CLI tool to send Telegram bot notifications after scripts or cron jobs
Readme
tg-notify
CLI tool to send Telegram bot notifications.
Install
npm install -g @garydu/tg-notifyUsage
tg-notify "Backup successful"echo "Backup finished" | tg-notifytg-notify "Backup successful" --BOT_TOKEN=tokenHere --CHAT_ID=chatIdtg-notify "Backup successful" --BOT_TOPIC=HomeLabNotes
- Requires Node.js 18+ (uses built-in
fetch). - If a message starts with
-, use--to end flags:tg-notify -- "--starts-with-dash". - To disable an env-configured topic for a single run, pass
--BOT_TOPIC.
Configuration
The CLI reads these environment variables by default:
TG_NOTIFY_BOT_TOKENTG_NOTIFY_CHAT_IDTG_NOTIFY_BOT_TOPIC
Add them to your shell profile (for example ~/.zshrc) and reload your shell:
export TG_NOTIFY_BOT_TOKEN=your-token
export TG_NOTIFY_CHAT_ID=your-chat-id
export TG_NOTIFY_BOT_TOPIC=HomeLab