Telegram bot reporting OpenWebRX MQTT events to @YourChannel or in private message.
openwebrx-telegram-bot listens to MQTT events from an OpenWebRX server and sends notifications to a specified Telegram chat. It provides real-time updates about client connections, disconnections, chat messages, receiver profile changes, etc.
See ChangeLog for more info.
- The bot will reply to some Commands
- Includes offline geolocation lookup for client IP addresses. You need maxmind.com free license key. (WARNING: Keep in mind that the first run will take few minutes to cache the GeoIP data)
- The Bot will reply to your private messages with your Chat ID (so you can use it later in the config)
- /help - show help
- /getid - reply with ChatID of the user, who sent the command
- /last <
mode
> [how_many
] - reply with last messages from background decoders
- Node.js
- A working MQTT Broker.
- Access to an MQTT broker used by OpenWebRX. Configure MQTT in OpenWebRX.
- Telegram Bot Token. Setup Telegram Bot.
- MaxMind GeoIP API License key (for database updates). Register for a free account and get a License Key.
-
Clone the repository:
git clone https://github.com/0xAF/openwebrx-telegram-bot.git cd openwebrx-telegram-bot
-
Install dependencies:
npm install
-
Configure environment variables by editing the .env file:
MQTT_BROKER_URL="mqtt://your-mqtt-broker:1883" MQTT_USERNAME= MQTT_PASSWORD= BOT_TOKEN=your_telegram_bot_token BOT_CHAT_ID=your_telegram_chat_id MAXMIND_API_KEY=your_maxmind_api_key GEODATADIR=/tmp/geoip # absolute path #DEBUG=bot:*,-bot:Decoders # if you want to see debug, without the decoders spam
-
Update GeoIP database:
./update-geoip-db.sh
-
Start the bot:
npm run start
You can also run the bot using Docker. This is the easiest way to get started if you don't want to install Node.js and dependencies manually.
-
Get the docker image by one of the following methods:
-
Pull from Docker hub.
docker pull slechev/openwebrx/telegram-bot
-
Build it yourself.
docker build -t openwebrx-telegram-bot .
-
-
Create a
.env
file in the project directory with your configuration (see above for required variables). -
Run the container, mounting the directory for GeoIP data and using the .env file:
-
Docker stand alone
docker run --env-file .env -v /tmp/geoip:/tmp/geoip slechev/openwebrx-telegram-bot
-
Docker compose (use the example file)
docker compose up -d
-
This will start the bot inside a container, using your environment variables and the GeoIP database directory.
The bot will connect to the MQTT broker and start sending notifications to the configured Telegram chat.
Variable | Description | Required |
---|---|---|
MQTT_BROKER_URL | URL of the MQTT broker | Yes |
MQTT_TOPIC_BASE | MQTT base topic for subscription (default: openwebrx) | No |
MQTT_USERNAME | MQTT broker username | No |
MQTT_PASSWORD | MQTT broker password | No |
BOT_TOKEN | Telegram bot token | Yes |
BOT_CHAT_ID | Telegram chat ID (e.g., @YourChannel or chat numeric ID) |
Yes |
MAXMIND_API_KEY | MaxMind GeoIP API key (for DB updates) | Yes |
GEODATADIR | Directory for geolocation data files (Do not change for Docker) | Yes |
DEBUG | Print DEBUG info to the console (use DEBUG=bot:*) | No |
- Open OpenWebRX Settings page.
- Go to "Spotting and reporting".
- Find "MQTT settings" section.
- Fill the required data.
- Set the "MQTT topic" to "
openwebrx/YourReceiverShortName
"
The bot subscribes to the following MQTT topics from OpenWebRX:
openwebrx/+/CLIENT
— for client connection, disconnection, and chat messagesopenwebrx/+/RX
— for receiver profile changes
This is due to support multiple OpenWebRx receivers in one MQTT broker. You should set the "MQTT topic" in OpenWebRx to "openwebrx/ReceiverShortName
"
- Create new Bot with @BotFather. See instructions.
- Get the Token and set it in your
.env
file. - (Optionaly) Create a Channel and add the Bot to the channel (with admin role).
MIT License. See LICENSE for details.