- Open Telegram app and find @BotFather
- Type
/start
and then/newbot
to create new bot. Enter unique name for the bot.
- Once you do that, bot should respond to you with token ID. Ctrl+C this token.
- Now create new channel on Telegram.
Find a name and hit Create
- Edit channel and create discussion group for that channel:
Assign some name for that group and hit Create.
- Now you have to return to @BotFather bot and set
/setjoingroups
enabled for your Bot.
- Go back once to your Bot and edit his settings. Tell him to join your group.
Select group chat:
- Open link:
https://api.telegram.org/bot<YOUR-BOT-TOKEN>/getUpdates
but replace it with your BOT Token.
Find the chat id now. It's the one just around your chat group name:
NOTE: My one starts with minus at the begining and thats correct.
- Open FAQ SSH to your NAS and test Bot:
curl 'https://api.telegram.org/bot<TOKEN>/sendMessage?chat_id=<CHAT_ID>&text=test123'
eg.
Bash:curl 'https://api.telegram.org/bot1234567890:ABCDEFGH/sendMessage?chat_id=-1001756444567&text=test123'
- Now you should receive on telegram message from your Bot:
This mean your bot seems to be working correctly.
- Open Rdownload share and find
script
directory.
- Create new empty file
telegram.sh
and open it in Notepad.
- Ctrl+C and Ctrl+V to notepad this code snippet.
(Make sure to replace your TOKEN and CHAT_ID variables)
Bash:#!/usr/bin/rtorrent/bin/bash TOKEN=1234567890:ABCDEFGHIJ CHAT_ID=-0000111122223333 cd `dirname $0` event_name=$(basename `pwd`) echo "${event_name}: $@" CMD_CURL=/usr/bin/rtorrent/bin/curl EVENT_TYPE=$1 EVENT_HASH=$2 EVENT_NAME=$3 EVENT_PATH=$4 EVENT_LABEL= [ "$5" == "" ] || EVENT_LABEL="${5}: " $CMD_CURL "https://api.telegram.org/bot${TOKEN}/sendMessage?chat_id=${CHAT_ID}&text=$EVENT_LABEL ${EVENT_TYPE}: $EVENT_NAME" exit 0
- Assign executable permission for telegram.sh. So from FAQ SSH run chmod +x on that script.
Bash:chmod +x /share/Rdownload/scripts/telegram_bot.sh
You can test from FAQ SSH telegram bot before:
Bash:/share/Rdownload/scripts/telegram_bot.sh finished 0123456 Windows.12.Pro.Beta-ISO /share/Rdownload/complete/software software
Result:
- Now the last step is to decide what types of notification you want to receive. So move and place that file in any category you want, eg. event.download.finished:
- That's all.
Voila!