feat: 新增 SafeW 出站通知渠道
通过 Bot API sendMessage 投递渲染后的通知,MarkdownV2 自动转义标题与正文。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# AIAA Notification Service
|
||||
|
||||
纯 Go 实现的多渠道通知服务。上游系统通过 Webhook 推送消息,服务按来源解析、匹配规则、条件过滤、渲染模板后,异步分发到钉钉 / 企业微信 / 邮件 / Bark。
|
||||
纯 Go 实现的多渠道通知服务。上游系统通过 Webhook 推送消息,服务按来源解析、匹配规则、条件过滤、渲染模板后,异步分发到钉钉 / 企业微信 / 邮件 / Bark / SafeW。
|
||||
|
||||
## 核心概念
|
||||
|
||||
@@ -14,7 +14,7 @@ rule N──M channel (via rule_channel,可独立开关)
|
||||
|------|------|
|
||||
| **Source** | 来源系统,持有独立 `api_key`,定义 body 解析方式(json / regex / text) |
|
||||
| **Template** | Go `text/template` 模板 |
|
||||
| **Channel** | 发送渠道配置(钉钉 / 企微 / 邮件 / Bark) |
|
||||
| **Channel** | 发送渠道配置(钉钉 / 企微 / 邮件 / Bark / SafeW) |
|
||||
| **Rule** | 绑定 `source + event → template + channels`,可选条件过滤 |
|
||||
| **MessageLog** | 发送记录,便于排查 |
|
||||
|
||||
@@ -351,7 +351,7 @@ Query:`page`、`page_size`(默认同 sources)。**200:** `{ "data": Temp
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
|------|------|------|------|
|
||||
| `name` | string | 是 | 唯一名称(规则里用此名引用) |
|
||||
| `type` | string | 是 | `dingtalk` / `wecom` / `email` / `bark` |
|
||||
| `type` | string | 是 | `dingtalk` / `wecom` / `email` / `bark` / `safew` |
|
||||
| `config` | object | 是 | 见下方各渠道配置 |
|
||||
| `status` | int | 否 | 默认 `1` |
|
||||
|
||||
@@ -398,6 +398,17 @@ SMTP 使用全局 `config.yaml` 的 `smtp` 段;支持 587 STARTTLS / 465 TLS
|
||||
}
|
||||
```
|
||||
|
||||
**SafeW `safew`**
|
||||
|
||||
```json
|
||||
{
|
||||
"token": "<bot token>",
|
||||
"chat_id": "123456789"
|
||||
}
|
||||
```
|
||||
|
||||
`chat_id` 可为数字或字符串(含 `@username`)。消息以 MarkdownV2 发送:标题加粗,标题和正文均自动转义。
|
||||
|
||||
#### `GET /api/v1/channels` — 列表
|
||||
|
||||
Query:`page`、`page_size`。**200:** `{ "data": Channel[], "total", "page" }`
|
||||
|
||||
Reference in New Issue
Block a user