Giter VIP home page Giter VIP logo

telegram-bot-notifier's Introduction

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.

telegram-bot-notifier's People

Contributors

dependabot[bot] avatar frostwalk avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.