Key Features • How To Use • Support • License
- Connecting to Telegram Bot API by token authentication
- Connecting to MQTT broker without authentication
- Forwarding any messages from Telegram Bot API to MQTT in the same JSON format as Telegram Update object
- Requesting any Telegram Bot API methods with JSON data from the MQTT message
- Configuring all gateway options via environment variables
To clone and run this application, you'll need Git and Rust installed on your computer.
From your command line:
# Clone this repository
$ git clone https://github.com/nizovtsevnv/telegram-mqtt-bridge
# Go into the repository
$ cd telegram-mqtt-bridge
# Install dependencies and run the app
$ RUST_LOG=info \
TELEGRAM_TOKEN=CHANGE_IT_TO_YOUR_VALUE \
QUEUE_HOST=localhost \
QUEUE_PORT=1883 \
SEND_TO_TELEGRAM=messages-to-telegram \
SEND_TO_QUEUE=messages-from-telegram \
cargo run
To set up options use environment variables:
- (optional) CLIENT_ID - identifier on MQTT broker, default value - "telegram-mqtt-bridge"
- (optional) QUEUE_HOST - MQTT broker, default value - "localhost"
- (optional) QUEUE_POLLING_TIMEOUT - polling request timeout, default value - 60 seconds
- (optional) QUEUE_PORT - MQTT broker port, default value - 1883
- (optional) RUST_LOG - logging level, default value - "error"
- (optional) SEND_TO_QUEUE - queue name for messages from Telegram to MQTT, default value - "messages-from-telegram"
- (optional) SEND_TO_TELEGRAM - queue name for messages from MQTT to Telegram, default value - "messages-to-telegram"
- (optional) TELEGRAM_POLLING_TIMEOUT - polling request timeout, default value - 60 seconds
- (required) TELEGRAM_TOKEN - authentication token for Telegram Bot API
You can make static executable with preconfigured Docker Alpine builder image, run in your console:
bin/build-static-executable
MIT