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
+1 -1
View File
@@ -221,7 +221,7 @@ curl -X POST 'http://localhost:8080/api/v1/channels' \
"name": "dingtalk-prod",
"type": "dingtalk",
"config": {
"webhook_url": "https://oapi.dingtalk.com/robot/send?access_token=xxx",
"access_token": "xxx",
"secret": "SEC..."
},
"status": 1
+1 -1
View File
@@ -312,7 +312,7 @@
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"dingtalk-prod\",\n \"type\": \"dingtalk\",\n \"config\": {\n \"webhook_url\": \"https://oapi.dingtalk.com/robot/send?access_token=xxx\",\n \"secret\": \"SEC...\"\n },\n \"status\": 1\n}"
"raw": "{\n \"name\": \"dingtalk-prod\",\n \"type\": \"dingtalk\",\n \"config\": {\n \"access_token\": \"xxx\",\n \"secret\": \"SEC...\"\n },\n \"status\": 1\n}"
},
"url": "{{baseUrl}}/api/v1/channels"
}