notify about download complete in telegram

notify about download complete in telegram


  1. create script ~/.config/transmission-daemon/telenotifu.sh

#!/usr/bin/env bash

# Bot token
BOT_TOKEN="here is your telegram bot token"

# Your chat id
CHAT_ID="here is your chat id"

# Notification message
MESSAGE="Download Completed: ${TR_TORRENT_NAME}"
MESSAGE=$(echo $MESSAGE | jq "@uri" -jRr)

# Prepares the request payload
PAYLOAD="https://api.telegram.org/bot${BOT_TOKEN}/sendMessage?chat_id=${CHAT_ID}&text=${MESSAGE}"

# Send message
curl -s -S -X POST "${PAYLOAD}"

# Prints a info message in the console
echo "${TR_TIME_LOCALTIME} - ${TR_TORRENT_NAME}] Download completed. Telegram notification sent."

  1. add script to transmission config ~/.config/transmission-daemon/settings.json

{
####### CUTTED CONFIG
"script-torrent-done-enabled": true,
"script-torrent-done-filename": "/home/USERNAME/.config/transmission-daemon/telenotifu.sh",
####### CUTTED CONFIG
}

Содержание