[GH-ISSUE #6863] [Question]: AutoBackup #4559

Open
opened 2026-10-31 20:40:31 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @Rockst4r4 on GitHub (Oct 17, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6863

What are you trying to do?

hello
how can i get auto backup to telegram bot

What have you already tried?

No response

3x-ui version

3.10

How did you install 3x-ui?

install.sh script

Operating system

ubuntu 24

Screenshots or config snippets

No response

Before submitting

  • I read the Wiki and searched existing issues.
  • This is a usage question, not a bug report.
  • This question is written in English.
Originally created by @Rockst4r4 on GitHub (Oct 17, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6863 ### What are you trying to do? hello how can i get auto backup to telegram bot ### What have you already tried? _No response_ ### 3x-ui version 3.10 ### How did you install 3x-ui? install.sh script ### Operating system ubuntu 24 ### Screenshots or config snippets _No response_ ### Before submitting - [x] I read the [Wiki](https://github.com/MHSanaei/3x-ui/wiki) and searched [existing issues](../issues?q=is%3Aissue). - [x] This is a usage question, not a bug report. - [x] This question is written in English.
Author
Owner

@github-actions[bot] commented on GitHub (Oct 17, 2026):

Automatic backups to Telegram are already built in. They go out with the Telegram bot's periodic report, so you need to switch on the bot, choose a report schedule and turn on the Database Backup switch.

Steps

  1. Create a bot with @BotFather and copy its token.
  2. Find your numeric Telegram user ID. Once the bot is connected, its /id command shows it.
  3. In the panel, open Panel Settings → Telegram and set:
    • Enable Telegram Bot: on
    • Telegram Token: the token from BotFather
    • Admin Chat ID: your numeric ID. For more than one admin, separate the IDs with commas.
    • Notification Time: how often the report (and the backup) is sent. The default is @daily. You can pick a preset or choose Custom and enter a cron expression such as 0 3 * * *.
    • Database Backup: on ("Send a database backup file with a report")
  4. Click Save, then Restart Panel. The report job is only scheduled when the panel starts, so a new schedule takes effect after the restart.
  5. Send your bot a message (for example /start) so it is allowed to message you.

Every time the schedule fires, each admin ID gets the server usage report plus the backup file. If you need a backup straight away, use the admin's inline Backup button in the bot.

How it works in the code

  • internal/web/web.go:395-401: the "Telegram notify" job is registered only when the bot is enabled, using the tgRunTime setting (default @daily).
  • internal/web/service/tgbot/tgbot_report.go:40-43: the periodic report attaches the backup only when that switch is on:
    backupEnable, err := t.settingService.GetTgBotBackup()
    if err == nil && backupEnable {
    	t.SendBackupToAdmins()
    }
    
  • internal/web/service/setting.go:95-96: the defaults are "tgRunTime": "@daily" and "tgBotBackup": "false", so backups stay off until you turn them on.

Full documentation: docs/content/docs/en/operations/telegram-bot.mdx (the "Reports & alerts" and "Settings" sections) and docs/content/docs/en/operations/backup-restore.mdx.

If no backup arrives after you set this up, reply with the panel log lines from around the scheduled time. Lines containing Telegram notify or Error in getting db backup are the most useful.

Verdict: Not a bug (expected behaviour). This is a usage question, and the feature already exists.

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:6235158968 --> @github-actions[bot] commented on GitHub (Oct 17, 2026): Automatic backups to Telegram are already built in. They go out with the Telegram bot's periodic report, so you need to switch on the bot, choose a report schedule and turn on the **Database Backup** switch. **Steps** 1. Create a bot with [@BotFather](https://t.me/BotFather) and copy its token. 2. Find your numeric Telegram user ID. Once the bot is connected, its `/id` command shows it. 3. In the panel, open **Panel Settings → Telegram** and set: - **Enable Telegram Bot**: on - **Telegram Token**: the token from BotFather - **Admin Chat ID**: your numeric ID. For more than one admin, separate the IDs with commas. - **Notification Time**: how often the report (and the backup) is sent. The default is `@daily`. You can pick a preset or choose Custom and enter a cron expression such as `0 3 * * *`. - **Database Backup**: on ("Send a database backup file with a report") 4. Click **Save**, then **Restart Panel**. The report job is only scheduled when the panel starts, so a new schedule takes effect after the restart. 5. Send your bot a message (for example `/start`) so it is allowed to message you. Every time the schedule fires, each admin ID gets the server usage report plus the backup file. If you need a backup straight away, use the admin's inline **Backup** button in the bot. **How it works in the code** - `internal/web/web.go:395-401`: the "Telegram notify" job is registered only when the bot is enabled, using the `tgRunTime` setting (default `@daily`). - `internal/web/service/tgbot/tgbot_report.go:40-43`: the periodic report attaches the backup only when that switch is on: ```go backupEnable, err := t.settingService.GetTgBotBackup() if err == nil && backupEnable { t.SendBackupToAdmins() } ``` - `internal/web/service/setting.go:95-96`: the defaults are `"tgRunTime": "@daily"` and `"tgBotBackup": "false"`, so backups stay off until you turn them on. Full documentation: `docs/content/docs/en/operations/telegram-bot.mdx` (the "Reports & alerts" and "Settings" sections) and `docs/content/docs/en/operations/backup-restore.mdx`. If no backup arrives after you set this up, reply with the panel log lines from around the scheduled time. Lines containing `Telegram notify` or `Error in getting db backup` are the most useful. Verdict: Not a bug (expected behaviour). This is a usage question, and the feature already exists. _This reply was generated automatically; a maintainer may follow up._ <!-- claude-issue:analyst -->
Author
Owner

@MURKA05-gigant commented on GitHub (Oct 21, 2026):

  1. In this bot @BotFather in Telegram you creating your bot and get\copy your token.
  2. In 3x-ui in panel you enable Telegram bot and paste your bot token
Image
  1. In this bot @id_bot you get your id from your account in Telegram
  2. Paste your id in field for "Admin Chat ID"
<!-- gh-comment-id:6326310747 --> @MURKA05-gigant commented on GitHub (Oct 21, 2026): 1) In this bot @BotFather in Telegram you creating your bot and get\copy your token. 2) In 3x-ui in panel you enable Telegram bot and paste your bot token <img width="2740" height="730" alt="Image" src="https://github.com/user-attachments/assets/aa405774-a2be-4ae1-9fdc-357aa0160603" /> 3) In this bot @id_bot you get your id from your account in Telegram 4) Paste your id in field for "Admin Chat ID"
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#4559
No description provided.