feat(钉钉通道): 支持仅使用 access_token 配置钉钉机器人

Motivation:
钉钉机器人的 webhook 前缀固定不变,要求用户填写完整 URL 冗余且容易出错。简化通道配置项,降低接入配置成本,同时保证存量配置不受影响。

Changes:

* 钉钉通道配置改用 access_token,webhook 前缀由内部固定拼接
* 保留对旧 webhook_url 配置的兼容,access_token 存在时优先生效
* 新增 webhook 地址解析逻辑的单元测试,覆盖优先级与回退场景
* 同步更新 README、HTTP 请求示例及设计文档中的配置示例
* E2E 测试改用 E2E_DINGTALK_ACCESS_TOKEN 环境变量并按新格式创建通道
This commit is contained in:
2026-08-19 15:14:38 +08:00
parent cd3db8d453
commit c7e154d7cc
7 changed files with 65 additions and 19 deletions
+3 -3
View File
@@ -388,12 +388,12 @@ Query`page`、`page_size`(默认同 sources)。**200** `{ "data": Temp
```json
{
"webhook_url": "https://oapi.dingtalk.com/robot/send?access_token=xxx",
"access_token": "xxx",
"secret": "SEC..."
}
```
`secret` 可选(加签机器人时填写)。消息类型:markdown。
`secret` 可选(加签机器人时填写),webhook 前缀固定,无需填写完整 URL。消息类型:markdown。
**企业微信 `wecom`**
@@ -605,7 +605,7 @@ curl -s -X POST http://localhost:8080/api/v1/channels \
-d '{
"name":"dingtalk-prod",
"type":"dingtalk",
"config":{"webhook_url":"https://oapi.dingtalk.com/robot/send?access_token=xxx","secret":"SEC..."}
"config":{"access_token":"xxx","secret":"SEC..."}
}'
# 4. 创建规则