# 宝塔面板/云安全监控 - 告警通知添加Telegram通知

### 宝塔开心版官网 <https://www.BTKaiXin.com> <a href="#install" id="install"></a>

### ✈️宝塔站长群 <https://qun.BTKaiXin.com> <a href="#install" id="install"></a>

### 前言 <a href="#intro" id="intro"></a>

Telegram机器人的发送信息功能需要指定聊天窗口ID，接下来介绍的则是如何利用机器人获取Telegram的个人ID及群组ID。

### 一、注册机器人并获取Token <a href="#register-telegram-bot" id="register-telegram-bot"></a>

与官方机器人 [@BotFather](https://t.me/botfather) 对话，注册并获取机器人Token；点击以下链接查看教程

{% content-ref url="/pages/6baChHMUnFZN9v5mrCmd" %}
[Telegram Bot 机器人注册教程](/telegram-bot/register-new-telegram-bot.md)
{% endcontent-ref %}

### 二、获取个人ID 和 获取群组ID <a href="#get-my-id" id="get-my-id"></a>

将另外一个机器人 [@tghelp](https://t.me/tghelp) 拉入提前创建的告警通知群；

机器人进群的时候就会自动发出当前对话ID，或群组ID：

```
Your user ID: 888888888
Current chat ID: -1002171794401
```

获取完这两行信息，即可将该机器人踢出群。

### 三、配置宝塔面板的告警通知模块为Telegram / 配置宝塔云控的告警方式为Telegram <a href="#config-notice" id="config-notice"></a>

```
https://api.telegram.org/bot<机器人TOKEN>/sendMessage?chat_id=<-1001612345678>
```

3.1、将[@BotFather](https://t.me/BotFather) 分配的机器人TOKEN替换到链接中的<机器人TOKEN>，<mark style="color:orange;">需要删掉前后尖括号<></mark> ；

3.2、将链接最后的数字ID替换为需要接收消息的对话ID，ID可能带有 - 减号，<mark style="color:orange;">需要删掉前后尖括号<></mark> ；

{% hint style="info" %}
chat\_id 可以是个人ID，也可以是私密群组或公开群组的ID，<mark style="color:orange;">只能填写其中一个ID</mark>；

Your user ID: 个人对话ID，如需通知直接由机器人发给自己，链接内请使用 Your user ID后的数字ID进行拼接；<mark style="color:orange;">需要与该机器人进行对话才能接收通知消息</mark>；

Current chat ID: 群组对话ID，如需通知发送到Telegram群，链接内请使用 Current chat ID 进行拼接；<mark style="color:orange;">可能需要给该机器人设置为群组管理员权限</mark>。
{% endhint %}

3.3、将机器人Token和接收告警消息的对话ID按照上述格式进行拼凑，然后复制粘贴到 【宝塔面板-面板设置-告警通知- Telegram】 或 【宝塔云监控-告警设置-Telegram】。

添加成功后，系统会自动发送测试通知到您配置的这个Telegram对话里；

### 四、FAQ <a href="#faq" id="faq"></a>

Q1：宝塔面板 和 宝塔云安全监控 可以共用一个机器人BOT通知到一个群组吗？

A1：经测试，可以！

### 宝塔顶尖站长群 <https://qun.BTKaiXin.com> <a href="#install" id="install"></a>

End.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.btkaixin.com/telegram-bot/telegram-bot-notification.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
