OpsVault

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:

/newbot

Follow 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:AAFxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Keep this token secret.

Get your chat ID

For personal notifications:

  1. Send any message to your new bot
  2. Open this URL in a browser (replace <TOKEN> with your token):
    https://api.telegram.org/bot<TOKEN>/getUpdates
  3. Find the "chat" object in the response:
    "chat": {
      "id": 123456789,
      "type": "private"
    }
    The id value is your chat ID.

For a group chat:

  1. Add the bot to the group
  2. Send a message in the group
  3. Open the same getUpdates URL — 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/environment

Or set it in the systemd service override:

systemctl edit opsvault
[Service]
Environment=TELEGRAM_TOKEN=123456789:AAFxxx

Configure 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 opsvault

Test the notification

Run a manual backup to trigger a notification:

opsvault backup run

You 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 getUpdates again)
  • 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 /revoke in BotFather

Messages stop coming:

  • The bot may have been blocked — send /start to the bot again

On this page