Simple command line interface to send notifications through Telegram Bot.
git clone https://aur.archlinux.org/tg-notify.git
cd tg-notify
makepkg -sior using AUR helper
paru -S tg-notify
# or
yay -S tg-notifyEnsure dependencies are installed:
- bash
- coreutils
- util-linux
- sed
- curl
- jq
Then, download tg-notify shell script and make it executable.
curl -LO 'https://github.com/liljaylj/tg-notify/releases/latest/download/tg-notify'
chmod +x tg-notifyIn order to be able to send notifications through Telegram Bot (existing or create new with @BotFather), you need to set its API key.
tg-notify set-tokenNext, you need to add a chat where notifications will be sent to. You can PM bot or add bot to group and send message there.
tg-notify add-chatYou can add multiple chats to send out notifications.
To send notifications, you can use the send commands.
tg-notify send helloThis command will send a "hello" message to all the chats in list that were added in the previous step.
You can specify which chats notifications will be sent to. To do this, list the chat ID prefixes.
Say we have such list of chats:
-1231231234 Test Group 1
-1239878988 Test Group 2
-4328829929 Test Group 3
234234234 liljaylj
tg-notify send '‼️ Backup failed!' @123 234234This will send 'Test Group 1, Test Group 2 and to user liljaylj.
Usage:
tg-notify set-token set Bot API token
tg-notify remove-token remove Bot API token
tg-notify add|add-chat add chat to chat-list
tg-notify ls|list-chats print chat-list
tg-notify rm|remove-chat [chat id] remove chat from chat-list
tg-notify e|edit|edit-chat-list open chat-list with default editor
tg-notify [-f|--format <format>] send [msg] [*chat ids] send message
tg-notify -v|--version|version print version information
tg-notify -h|--help|usage|help display this help message
Format options:
2|m|md|markdown - MarkdownV2
h|html - HTML
1|o|old|markdown1 - Markdown
Notes: You can replace "-" prefix in group ID with "@" or enter it after --.
Specify '-' instead of <msg> to read the message from stdin.