** Please note that this project is maintained on GitLab, and you can find the latest version of the code, as well as updates and bug fixes, at https://gitlab.com/krafi/linux-notifications-to-telegram.git If you encounter any issues while using the application, we encourage you to report them on the GitLab repository so that we can address them as soon as possible. **
This script is a Bash script that continuously monitors the D-Bus system message bus for notifications and sends them to a Telegram chat using the Telegram Bot API.
https://krafi.info/how-to-get-desktop-notifications-on-telegram-using-bash-script/index.html
**Please keep in mind that this script is offered "as is," with no guarantee or support.
This script requires the following dependencies to be installed:
- Bash
- jq
- curl
Follow these instructions to run this script: note: its better to do all of this thing inside your ~/.local/bin/ So,
cd ~/.local/bin/
- Clone the repo
git clone --depth 1 https://gitlab.com/krafi/linux-notifications-to-telegram.git
- Open a terminal and browse to the directory storing the script.
cd linux-notifications-to-telegram
- Open the script in a text editor and modify the following variables:
-
TELEGRAM_API_KEY
: Your Telegram Bot API key. ( search offical "BotFather" telegram for , and create a api key, Dont forget to join your bot first than run this script. ) -
TELEGRAM_CHAT_ID
: The ID of the Telegram chat where you want to receive notifications. ( #search for a telegram bot "userunfobot" it will tell you your ID 10****** )
-
nano run.sh #make sure nano is installed on your linux system
-
Save the changes to the script and exit the text editor.
-
For keep the script executable, just use command “:
sudo chmod +x run.sh
sudo chmod +x i3_autostart.sh
6 . Use the following code to launch the code:
./run.sh
- Dont forget to setup autostart
The script will continuously monitor for notifications and send them to the specified Telegram chat using the Telegram Bot API.
This script is released under the GPL-3 License.