Install cv4pve-botgram, the Telegram bot for Proxmox VE
cv4pve-botgram runs outside the cluster (on a management VM, a small server, a container) and talks only to the Proxmox VE REST API on port 8006. Nothing is installed on the nodes. The machine it runs on must reach the nodes and, on the Internet, Telegram: the bot connects out and waits for your messages, so no port is opened towards your network.
First run
Section titled “First run”-
Install cv4pve-botgram
arch=$(uname -m | sed 's/x86_64/x64/;s/aarch64/arm64/;s/armv7l/arm/')wget https://github.com/Corsinvest/cv4pve-botgram/releases/latest/download/cv4pve-botgram-linux-$arch.zipunzip cv4pve-botgram-linux-$arch.zipchmod +x cv4pve-botgramcurl -s https://api.github.com/repos/Corsinvest/cv4pve-botgram/releases/latest | grep -o "https://[^\"]*-$(dpkg --print-architecture)\.deb" | xargs curl -LOsudo dpkg -i cv4pve-botgram-*-$(dpkg --print-architecture).debcurl -s https://api.github.com/repos/Corsinvest/cv4pve-botgram/releases/latest | grep -o "https://[^\"]*-$(rpm --eval %_target_cpu)\.rpm" | xargs curl -LOsudo rpm -i cv4pve-botgram-*-$(rpm --eval %_target_cpu).rpmyay -S cv4pve-botgrambrew install corsinvest/tap/cv4pve-botgramcurl -s https://api.github.com/repos/Corsinvest/cv4pve-botgram/releases/latest | grep -o "https://[^\"]*-$(uname -m)\.pkg" | xargs curl -LOsudo installer -target / -pkg cv4pve-botgram-*-$(uname -m).pkgarch=$(uname -m | sed 's/x86_64/x64/')curl -LO https://github.com/Corsinvest/cv4pve-botgram/releases/latest/download/cv4pve-botgram-osx-$arch.zipunzip cv4pve-botgram-osx-$arch.zipchmod +x cv4pve-botgramwinget install Corsinvest.cv4pve.botgram$arch = @{ AMD64 = 'x64'; x86 = 'x86'; ARM64 = 'arm64' }[$env:PROCESSOR_ARCHITECTURE]Invoke-WebRequest https://github.com/Corsinvest/cv4pve-botgram/releases/latest/download/cv4pve-botgram.exe-win-$arch.zip -OutFile cv4pve-botgram.zipExpand-Archive cv4pve-botgram.zip -DestinationPath . -ForceAll files are on the latest release page.
-
Create a Telegram bot
Create the bot and get its token, in a minute from the Telegram app: see Telegram bot.
-
Create an API token
Create a Proxmox VE user and API token with the privileges for what the bot should do: see Permissions.
-
Run
cv4pve-botgramcv4pve-botgram --host=pve01 --api-token='bot@pve!bot=<uuid>' --token='<telegram-bot-token>' --chatsId=<chat-id>The bot logs in to the cluster and to Telegram, then prints who it is:
Start listeningTelegramBot User: @your_pve_botBot UserId: @123456789Proxmox VEpve01:8006Press Ctrl+C to stop.It stays in the foreground until it is stopped.
-
Send
/helpto the botOpen the chat with your bot in Telegram and send
/help: the bot answers with the list of its commands, described in Commands.
Options
Section titled “Options”| Option | What it does |
|---|---|
--token |
Token of the Telegram bot, from BotFather. Required. |
--chatsId |
Telegram chat IDs allowed to use the bot, separated by commas. See Restrict the bot to your chats. |
The bot runs until it is stopped: Ctrl+C in a terminal, systemctl stop, or the Windows service manager.
To keep it running after you close the terminal, see Run as a service.
Host, API token, username and password, certificates and keeping the options in a file: see Connection.
- Commands: guests, nodes, and how a conversation with the bot works.
- API commands: any path of the Proxmox VE API from the chat.
- Run as a service: keep the bot running after you close the terminal.