Telegram Setup
Set up a Telegram bot to receive backup notifications.
Create a bot with BotFather
Open Telegram and start a chat with @BotFather.
Send:
/newbotFollow the prompts — choose a name and a username (must end in bot). BotFather will reply with your bot token:
Use this token to access the HTTP API:
123456789:AAFxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxKeep this token secret.
Get your chat ID
For personal notifications:
- Send any message to your new bot
- Open this URL in a browser (replace
<TOKEN>with your token):https://api.telegram.org/bot<TOKEN>/getUpdates - Find the
"chat"object in the response: The"chat": { "id": 123456789, "type": "private" }idvalue is your chat ID.
For a group chat:
- Add the bot to the group
- Send a message in the group
- Open the same
getUpdatesURL — the group chat ID will be a negative number like-987654321
Store the token securely
Add the bot token to /etc/environment so OpsVault can read it without storing it in the config file:
echo 'TELEGRAM_TOKEN=123456789:AAFxxx' >> /etc/environment
source /etc/environmentOr set it in the systemd service override:
systemctl edit opsvault[Service]
Environment=TELEGRAM_TOKEN=123456789:AAFxxxConfigure OpsVault
notifications:
on_success: true
on_failure: true
telegram:
enabled: true
bot_token_env: TELEGRAM_TOKEN
chat_id: "123456789"Validate and restart:
opsvault config validate
systemctl restart opsvaultTest the notification
Run a manual backup to trigger a notification:
opsvault backup runYou should receive a Telegram message within seconds.
Troubleshooting
No message received:
- Confirm you sent a message to the bot first (bots can't initiate conversations)
- Check the chat ID is correct (use
getUpdatesagain) - Check the token is set:
echo $TELEGRAM_TOKEN
"Unauthorized" error in logs:
- The bot token is invalid or has been revoked — generate a new one with
/revokein BotFather
Messages stop coming:
- The bot may have been blocked — send
/startto the bot again