How to Get Desktop Notifications on Telegram Using Bash Script
https://gitlab.com/krafi/linux-notifications-to-telegram
Do you ever miss important notifications while working on your desktop? Have you ever wished you could receive Linux Desktop or linux server notifications from your phone or other devices? In this article, we’ll demonstrate how to write a bash script that uses the Telegram Bot API to monitor desktop alerts and deliver them to a Telegram chat.
Let’s configure the Telegram Bot API first build a bot and get an API key in order to use the API. You can do this by searching for “BotFather” on Telegram and create a api key,
Once you have your API key,Dont forget to start the bot, read the “BotFather” message carefully. There is a link.TELEGRAM_API_KEY=“YOUR_TELEGRAM_API_KEY” you’ll also need to obtain the chat ID for the chat where you want to receive notifications. To do this, you can search for the “userinfobot” on Telegram and follow the instructions. TELEGRAM_CHAT_ID=“YOUR_TELEGRAM_CHAT_ID”
With your API key and chat ID in hand, you can now create your bash script. Here’s an example script that utilises dbus-monitor to listen for org.freedesktop alerts. Using the Telegram Bot API, it receives notifications and distributes them to the Telegram chat:
Don’t forget to read the GitLab page for more documentation.
Comments