Path: 宝塔面板 API 参考 › 消息推送

`POST /push`

这个请求地址通过 action 区分具体功能。下方列出每个 action 的参数、约束和调用示例。

## Request body

_Required._

One of:

- `get_modules_list`
- `get_task_template`

## Example request

```text
{
  "request_time": "string",
  "request_token": "string",
  "action": "get_modules_list"
}
```

## Code samples

### cURL（填写面板地址与签名）

```curl
curl --request POST \
  --url "https://your-panel.example.com:8888/push" \
  --header "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode "request_time=<Unix时间戳>" \
  --data-urlencode "request_token=<按 API 概览生成的签名>" \
  --data-urlencode "action=get_modules_list"
```

## Responses

### default

响应因 action 而异，见下方各 action 的详细说明。


## get_modules_list

获取可用的消息推送模块列表。

- **路由**：`POST /push`
- **action**：`get_modules_list`

## 输入参数

| 参数名称 | 必选 | 类型 | 描述 |
|----------|------|------|------|
| action | 是 | String | 固定值 `get_modules_list` |

## 输出参数

返回各推送模块配置，key 为模块名。

| 模块名 | 说明 |
|--------|------|
| panel_push | 面板基础提醒 |
| mail | 邮箱推送 |
| dingding | 钉钉 |
| feishu | 飞书 |
| weixin | 微信 |
| sms | 短信 |

## 示例

```json
{
    "panel_push": {"name": "panel_push", "title": "面板基础提醒", "version": "1.2"},
    "mail": {"name": "mail", "title": "邮箱", "setup": true}
}
```


## get_push_list

## get_push_list / get_push_logs

查看推送规则和推送日志。

- **路由**：`POST /push`

## get_push_list

获取当前配置的推送规则列表。

| 参数名称 | 必选 | 类型 | 描述 |
|----------|------|------|------|
| action | 是 | String | `get_push_list` |
| p | 否 | Integer | 页码 |
| limit | 否 | Integer | 每页数量 |

## get_push_logs

获取推送日志记录。

| 参数名称 | 必选 | 类型 | 描述 |
|----------|------|------|------|
| action | 是 | String | `get_push_logs` |
| p | 否 | Integer | 页码 |
| limit | 否 | Integer | 每页数量 |

## 相关接口

- [get_modules_list](/api/push/get_modules_list) — 推送模块列表

## 输出参数

| 参数名称 | 类型 | 描述 |
|----------|------|------|
| status | Boolean | 请求结果，`true` 表示成功 |
| msg | String | 提示信息 |


## get_task_template

获取消息推送的告警任务模板列表。

- **路由**：`POST /push`
- **action**：`get_task_template`

## 输入参数

| 参数名称 | 必选 | 类型 | 描述 |
|----------|------|------|------|
| action | 是 | String | 固定值 `get_task_template` |

## 输出

返回数组，每项为一个告警模板组，包含 `title` 和 `template` 字段。

```json
[{"title": "常用告警设置", "template": []}]
```

