OpsVault

Notifications

Get notified via Telegram or email when backups succeed or fail.

OpsVault can send notifications after each backup run. Both Telegram and email can be active at the same time.

Configuration

notifications:
  on_success: true    # notify when a backup succeeds
  on_failure: true    # notify when a backup fails

  telegram:
    enabled: false
    bot_token: ""             # bot token from @BotFather
    bot_token_env: "TELEGRAM_TOKEN"  # or read from env var (recommended)
    chat_id: ""               # your user ID or group chat ID

  email:
    enabled: false
    smtp_host: smtp.example.com
    smtp_port: 587
    smtp_tls: true            # use STARTTLS
    from: opsvault@example.com
    to:
      - admin@example.com
    username: opsvault@example.com
    password_env: SMTP_PASS   # SMTP password from env var

Telegram

Create a bot

Open Telegram and message @BotFather:

/newbot

Follow the prompts. BotFather will give you a token like: 123456789:AAFxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Get your chat ID

Message your new bot, then open:

https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates

Look for "chat":{"id": 123456789} in the response. That number is your chat ID.

For a group chat, add the bot to the group and look for a negative ID like -987654321.

Configure OpsVault

Store the token in an environment variable:

echo 'export TELEGRAM_TOKEN=123456789:AAFxxx' >> /etc/environment
source /etc/environment

Then update your config:

notifications:
  telegram:
    enabled: true
    bot_token_env: TELEGRAM_TOKEN
    chat_id: "123456789"

See the Telegram setup guide for more detail.

Email

notifications:
  email:
    enabled: true
    smtp_host: smtp.gmail.com
    smtp_port: 587
    smtp_tls: true
    from: opsvault@yourdomain.com
    to:
      - admin@yourdomain.com
      - oncall@yourdomain.com
    username: opsvault@yourdomain.com
    password_env: SMTP_PASS

Set the password:

echo 'export SMTP_PASS=yourpassword' >> /etc/environment
source /etc/environment

For Gmail, use an App Password rather than your account password.

See the email setup guide for provider-specific examples.

Notification content

On success:

Backup OK: myapp_prod

Backup of database "myapp_prod" completed in 3s.

File: /var/backups/opsvault/myapp_prod_20240115_020001.sql.gz

On failure:

Backup FAILED: myapp_prod

Backup of database "myapp_prod" failed after 1s.

Error: starting pg_dump: exec: "pg_dump": executable file not found in $PATH

Controlling when notifications are sent

notifications:
  on_success: false   # silent on success
  on_failure: true    # only notify on failure

On this page