Files
abot/plugins/trendradar_webhook/README.md
liuwei 055406d207 feat(trendradar): 新增空权限插件并接入webhook群权限校验
- 新建 trendradar_permission 空插件,仅注册 TRENDRADAR_WEBHOOK 功能用于后台群级开关

- webhook 发送前强制校验群权限,未开启群加入 blocked_groups 并拦截

- 更新对接文档,补充权限开关的启用步骤与返回字段说明
2026-04-21 16:37:23 +08:00

74 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# TrendRadar Webhook 适配说明
## 1. 接口地址
在 ABOT 侧新增了 webhook 入口:
`POST /webhook/trendradar`
示例:
`http://<你的ABOT地址>:8888/webhook/trendradar`
## 2. ABOT 配置
编辑 [admin/dashboard/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
```
## 2.1 群权限开关(必做)
已新增空插件用于权限管理:
- [main.py](/D:/learn/abot/plugins/trendradar_permission/main.py)
请在后台给目标群开启:
`📡 TrendRadar Webhook推送 [群级开关]`
说明:
1. webhook 在发送前会强制校验该群是否开启权限;
2. 未开启的群会被拦截,并在接口返回里出现在 `blocked_groups`
## 3. 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"}`
## 4. 可选:让 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"]
}
```
## 5. 返回结果
接口返回 JSON包含
1. `success`
2. `sent_groups`
3. `blocked_groups`
3. `failed_groups`