Skip to content

Super simple telegram bot that take text as argument and send it to a chat using telegram api.

License

Notifications You must be signed in to change notification settings

FrostWalk/telegram-bot-notifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telegram Bot Notifier

This is a very simple Telegram bot that sends any argument passed from the command line to a designated chat using the Telegram API. It uses the teloxide library. It is intended to be used inside an already existing Alpine container without modifying the image, so it's statically compiled with target musl.

Overview

The bot is designed to be used for receiving notifications on Telegram for backups generated by the fantastic piece of software Restic, as Restic does not natively support Telegram as a notification medium.

Usage

To send a message using the bot, use the following command:

TOKEN=<your-telegram-bot-token> CHAT_ID=<your-chat-id> ./target/release/<your-bot-executable> "Your message here"

Replace <your-telegram-bot-token> with your actual bot token and <your-chat-id> with the ID of the chat you want to send messages to. Replace <your-bot-executable> with the name of the executable file generated by Cargo.

For example:

TOKEN=123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11 CHAT_ID=000000000 ./target/release/telegram_bot "Test message from Restic."

Environment Variables

  • TOKEN: The token for your Telegram bot.
  • CHAT_ID: The ID of the chat where the bot will send messages.

Example Use Case

This bot is ideal for use with backup notifications from Restic, personally I use Backrest as web-ui for managing and configuring Restic. since Backrest is deployed as a container, I needed to create a dependency-free executable that I could mount so that after the backups are finished, Restic can invoke it passing the result as argument.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Acknowledgements

  • Restic for being an awesome backup program.
  • Backrest to make it so much easier to manage and configure Restic.
  • Teloxide for providing the Rust bindings for the Telegram Bot API.
  • Tokio for providing an amazing library for multithreading.

About

Super simple telegram bot that take text as argument and send it to a chat using telegram api.

Topics

Resources

License

Stars

Watchers

Forks