# X-Hub Telegram Bot: Alerts and Buttons

> For AI tools: this is the Markdown copy of https://xproxy.io/document/xproxy-hub-telegram. Every XProxy guide has one at its URL + `.md`; the index of all guides is https://xproxy.io/llms.txt.

Create your own Telegram bot, link your account with a one-time code, get alerts when a box or modem goes down, and rotate or reboot from your phone.

Get a Telegram message when a box goes offline or a modem stops working, and fix it with a button. You create the bot yourself in two minutes.

**You need:** a [running X-Hub](https://xproxy.io/document/xproxy-hub-setup), a Telegram account, and an **owner** login to set the bot up. Works on X-Hub on your box and on a VPS. X-Hub needs internet access to Telegram.

## How do I set up the Telegram bot?

**Step 1: Create your bot in Telegram (owner)**

In Telegram, open **@BotFather**. Send `/newbot` and answer two questions: a name for your bot, and a username that ends in `bot`.

BotFather replies with a **token**, a long text like `123456789:AAH...`. Copy it. Keep it private: anyone with the token controls the bot.

![The Bot setup card on the Telegram page with the BotFather link, the token box and the Save button marked (demo)](https://media1.xproxy.io/docs/hub/tg-1-setup-empty.webp)

> It is your own bot. XProxy never has your token. X-Hub talks to Telegram itself, so you need no public address.

**Step 2: Paste the token and Save (owner)**

In X-Hub, open **Telegram** under **Integrations**. In **Bot setup**, paste the token and click **Save**.

The card turns green and says **Connected as @your_bot**. The label says **Connected**. Click **Send test message** once someone has linked an account.

![Bot setup showing Connected, the bot name and the Send test message button marked (demo)](https://media1.xproxy.io/docs/hub/tg-2-connected.webp)

> If Telegram does not accept the token, the box says so under the field. Copy the whole token again from BotFather.

**Step 3: Get your link code**

Every person who wants alerts does this once, with their own X-Hub account. Open **Telegram** in X-Hub and click **Get my link**.

![The Link my Telegram card with the Get my link button marked (demo)](https://media1.xproxy.io/docs/hub/tg-3-get-link.webp)

> The card tells you what your role can do in Telegram. Owners and operators get buttons. Viewers get alerts and can look things up.

**Step 4: Open Telegram and press Start**

Click **Open in Telegram**, then press **Start** in the chat with your bot. The bot answers **Linked to hub user...**.

The code works once and lasts 10 minutes. If it expires, click **New code**. You can also send the text `/start CODE` to the bot yourself.

![The link code, the Open in Telegram button and the expiry timer marked (demo)](https://media1.xproxy.io/docs/hub/tg-4-link-code.webp)

> **For a team group:** add the bot to the group and send the `/start CODE` message there. Alerts then arrive in the group.

**Step 5: Check who is linked (owner)**

Under **Alert chats** you see every chat that gets alerts. A muted chat shows when it comes back. **Remove** stops alerts to that chat.

![The Alert chats table with a row, a muted chat and a Remove button marked (demo)](https://media1.xproxy.io/docs/hub/tg-5-chats.webp)

**Step 6: Unlink an account (owner)**

**Linked Telegram accounts** lists each Telegram name with its X-Hub user and role. **Unlink** cuts the connection. A person can also send `/unlink` to the bot.

![The Linked Telegram accounts table with a user row and the Unlink button marked (demo)](https://media1.xproxy.io/docs/hub/tg-6-accounts.webp)

> The bot only answers people you linked. Someone who finds your bot gets nothing.

## What alerts do I get?

| Alert | When |
| --- | --- |
| **Server is offline** | A box has been gone for 1 minute. |
| **Modem is offline** | A modem has been disconnected for 90 seconds. |
| **Modem stuck rotating** | A rotation has taken more than 5 minutes. |

- One message per problem. It is **edited in place**: when someone acknowledges it, it says who; when it is fixed, it is crossed out and says how long it took.
- Four or more new problems on one server arrive as **one grouped message** with an **Acknowledge all** button.
- While a server is offline, the problems of its own modems are put on hold.

## What do the buttons do?

| Button | Where | What it does |
| --- | --- | --- |
| **Acknowledge** | Alerts | Marks the problem as handled. |
| **Rotate IP** | Modem alerts and cards | Gets a new public IP. |
| **Modem actions** | Modem alerts | Opens the modem card. |
| **Reboot modem**, **Reset USB** | Modem card | Power-cycles the modem or its USB port. Asks **Yes** or **Cancel** first. |
| **Diagnose** | Modem card | Runs the health checks and names the first thing that fails. |
| **VPS doctor** | Server card | Checks the VPS forwarding of that server. |
| **Reboot server** | Server card, owners only | Reboots the whole box. A risky change, see [Passkeys](https://xproxy.io/document/xproxy-hub-passkeys). |

Every button checks the X-Hub role of the **person who pressed it**, not the chat. In a group, a viewer pressing **Rotate IP** gets a refusal, even if an operator linked the group. A **Free** box refuses rotation and reboots, like its own panel.

## Which commands can I send?

| Command | What it does |
| --- | --- |
| `/status` | Servers online, modems up, open problems. |
| `/incidents` | Open problems, with Acknowledge buttons for operators. |
| `/servers` | Every server with its modems. |
| `/server Office box` | One server: health, modems, VPS doctor, and for owners Reboot server. Type the server name. |
| `/find 10003` | Find a proxy by IP, port, label, IMEI or server name, then act on it. |
| `/mute 60` | Mute **new** alerts in this chat for 60 minutes (up to a week). Operators and owners. Existing alerts still update. |
| `/unmute` | Alerts on again. |
| `/allow 4` | Owners: after one passkey approval, risky changes run without asking for 4 hours (1 to 24). |
| `/stop` | Owners: end that time window now. |
| `/unlink` | Unlink your Telegram from X-Hub. |
| `/help` | What the bot can do for your role. |

## Can I see what people sent the bot?

Owners can. At the bottom of the **Telegram** page, **Chat history** lists commands, button presses and the bot replies for 30 days. Search by chat, kind, text or time, delete one chat or everything, and use the **Record** switch to stop recording. Link codes are hidden. In groups, the bot only sees commands, not other messages.

## FAQ

### Telegram is blocked in my country

X-Hub needs to reach `api.telegram.org`. Where that is blocked, start X-Hub with `-telegram-api https://your-relay` (or `XPROXY_HUB_TELEGRAM_API`) pointing at a Bot API relay or your own Bot API server. This is a start option of the X-Hub program, so it fits X-Hub on a VPS. For X-Hub on a box, [ask support](https://xproxy.io/document/remote-support). The page shows the address in use under **Bot setup**.

### I linked my account but get no alerts

Check **Alert chats**: the chat must say **On**, not **Muted**. Alerts only start for problems that open after you linked; send `/incidents` to see the open ones. Make sure the bot is still **Connected**.

### I want to use another bot

Paste the new token over the old one and click **Save**. Linked chats and accounts are kept. **Turn off** stops alerts and keeps the links, so alerts resume when you add a token again.

### Why can my colleague not press the buttons?

Their X-Hub account is a viewer. An owner can change the role in [Users and API keys](https://xproxy.io/document/xproxy-hub-users).

## What next?

Send the same alerts to Slack or your own tools, or let an AI assistant help.

[Webhooks →](https://xproxy.io/document/xproxy-hub-webhooks) [AI assistants →](https://xproxy.io/document/xproxy-hub-ai-assistants) [Troubleshooting →](https://xproxy.io/document/xproxy-hub-troubleshooting)

---

Source: https://xproxy.io/document/xproxy-hub-telegram
