12 Advanced
Sanaei edited this page 2026-06-03 00:48:59 +02:00

Setting Telegram bot

Usage

The web panel supports daily traffic, panel login, database backup, system status, client info, and other notifications and functions through a Telegram Bot.

3x-ui

To use the bot, set the bot-related parameters in the panel (Panel Settings → Telegram Bot), including:

  • Telegram Bot Token — the token from BotFather
  • Admin Chat ID(s) — one or more Telegram user IDs that act as bot admins (comma-separated)
  • Notification Time — when periodic reports are sent, in cron syntax
  • Login Notification — alert on panel logins
  • CPU Load Threshold (%) — alert when CPU usage exceeds this value
  • Database Backup — send a database backup with the periodic report
  • Bot Language — the language the bot replies in
  • Bot Proxy (optional) — route the bot's connection through a SOCKS5 proxy (useful where Telegram is blocked)
  • Custom Bot API Server (optional) — use a self-hosted Telegram Bot API server instead of api.telegram.org

Periodic reports also warn ahead of time about clients nearing their expiration date or traffic cap.

Reference syntax (cron):

  • @every 10s — notify every 10 seconds
  • @every 10m — notify every 10 minutes
  • @every 8h — notify every 8 hours
  • @hourly — hourly notification
  • @daily — daily notification (00:00)
  • @weekly — weekly notification
  • @monthly — monthly notification

Standard cron expressions are supported as well.

Telegram Bot Features

  • Periodic reports
  • Login notification
  • CPU threshold notification
  • Advance warnings for expiration time and traffic thresholds
  • Client report menu when the client's Telegram username is added to their config
  • Anonymous traffic lookup by UUID (VMESS/VLESS) or Password (Trojan)
  • Menu-based bot
  • Search client by email (admin only)
  • Check all inbounds
  • Check server status
  • Check depleted users
  • Receive backups on request and in periodic reports
  • Multi-language bot

Setting up the Telegram bot

Botfather

  • Create a new bot using the /newbot command. It will ask you 2 questions: a name and a username for your bot. Note that the username has to end with the word "bot".

Create new bot

  • Start the bot you've just created. You can find the link to your bot here.

token

  • Enter your panel and configure the Telegram bot settings as below:

Panel Config

Enter your bot token in input field number 3. Enter the user ID in input field number 4. The Telegram accounts with this ID will be the bot admins. (You can enter more than one, just separate them with ,)

How to get your Telegram user ID?

Use this bot. Start the bot and it will give you your Telegram user ID.

User ID

Setting Cloudflare WARP

What is it?

Cloudflare WARP is a free service developed by Cloudflare that enhances internet security and performance by masking traffic between your server and the internet. WARP is useful in the following cases:

  • When you need to hide the IP address of a server.
  • When some services do not open.

Setup

  1. Open the panel and go to Xray Configs.
  2. Open the Outbounds tab, click WARP, then the Create button.

image

We have created a WARP profile, but not yet set a WARP outbound. To create an outbound to redirect traffic to, click Add outbound and close the dialog box.

Redirect traffic to WARP

  1. Open the panel and go to Xray Configs.
  2. Open Routing Rules and click Add Rule.
  3. Add the following rule:

image

In this rule, we redirect all traffic from Reddit and Google (and all its services) to the WARP outbound.

Setting TOR proxy

What is it?

Tor, short for The Onion Router, is a free and open-source software designed to enable anonymous communication over the internet. It achieves this by routing your internet traffic through a global network of volunteer-operated servers, known as relays or nodes, thereby concealing your location and usage from surveillance and traffic analysis.

Setup

Tip

Before you start, make sure you have Docker installed. If it is not installed, see here for the installation script.

  1. Open a terminal and run this command:
docker run --restart unless-stopped -i -t -p 9050:9050 dperson/torproxy

This will start a SOCKS5 proxy with TOR; now it needs to be configured in the panel.

  1. Go to the panel and open Xray Configs.
  2. Go to the Outbounds tab and click Add Outbound.
  3. Fill out the form as follows and click Add Outbound:

Outbound Modal

Redirect traffic

Same thing as with WARP, but instead of the warp outbound, we use tor.