- 将 webhook 对接与群权限说明迁移到 plugins/trendradar_permission/README.md - 删除已无实际职责的 plugins/trendradar_webhook 文档目录内容 - 保持目录职责一致:权限插件目录承载配置与使用说明
81 lines
1.8 KiB
Markdown
81 lines
1.8 KiB
Markdown
# TrendRadar Webhook + 权限插件说明
|
||
|
||
## 1. 组成说明
|
||
|
||
当前实现分两部分:
|
||
|
||
1. 权限插件(本目录)
|
||
- 负责注册群级功能开关:`TRENDRADAR_WEBHOOK`
|
||
- 你可以在后台按群启用/关闭
|
||
|
||
2. webhook 接口(Dashboard 蓝图)
|
||
- 路径:`POST /webhook/trendradar`
|
||
- 文件:`admin/dashboard/blueprints/trendradar_webhook.py`
|
||
|
||
## 2. 接口地址
|
||
|
||
`POST /webhook/trendradar`
|
||
|
||
示例:
|
||
|
||
`http://<你的ABOT地址>:8888/webhook/trendradar`
|
||
|
||
## 3. ABOT 配置
|
||
|
||
编辑 [config.toml](/D:/learn/abot/admin/dashboard/config.toml):
|
||
|
||
```toml
|
||
[trendradar_webhook]
|
||
enabled = true
|
||
token = "your_secure_token"
|
||
default_group_ids = ["xxxx@chatroom"]
|
||
allow_payload_target_groups = false
|
||
send_timeout_seconds = 20
|
||
```
|
||
|
||
## 4. 群权限开关(必做)
|
||
|
||
请在后台给目标群开启:
|
||
|
||
`📡 TrendRadar Webhook推送 [群级开关]`
|
||
|
||
说明:
|
||
1. webhook 发送前会强制校验该群权限;
|
||
2. 未开启的群会被拦截,并在返回中出现在 `blocked_groups`。
|
||
|
||
## 5. TrendRadar 配置(Generic Webhook)
|
||
|
||
在 TrendRadar 里设置:
|
||
|
||
1. `NOTIFICATION_PROVIDER=generic_webhook`
|
||
2. `GENERIC_WEBHOOK_URL=http://<你的ABOT地址>:8888/webhook/trendradar`
|
||
3. `GENERIC_WEBHOOK_METHOD=POST`
|
||
4. `GENERIC_WEBHOOK_HEADERS={"Content-Type":"application/json"}`
|
||
5. `GENERIC_WEBHOOK_TEMPLATE={"token":"your_secure_token","title":"{title}","content":"{content}","source":"TrendRadar"}`
|
||
|
||
## 6. 可选:让 TrendRadar 指定目标群
|
||
|
||
若你希望不同热点推送到不同群:
|
||
|
||
1. ABOT 配置 `allow_payload_target_groups = true`
|
||
2. TrendRadar 模板加目标群字段:
|
||
|
||
```json
|
||
{
|
||
"token": "your_secure_token",
|
||
"title": "{title}",
|
||
"content": "{content}",
|
||
"target_group_ids": ["xxxx@chatroom", "yyyy@chatroom"]
|
||
}
|
||
```
|
||
|
||
## 7. 返回结果
|
||
|
||
接口返回 JSON,包含:
|
||
|
||
1. `success`
|
||
2. `sent_groups`
|
||
3. `blocked_groups`
|
||
4. `failed_groups`
|
||
|