创建通知渠道
POST
/web/v1/notification-channels/command/createWEB创建新的通知渠道。目前支持 EMAIL 渠道类型。
鉴权
需要有效的 JWT token 和 Turnstile 验证。网关校验:enableJwtToken=true,enableTurnstile=true。
请求参数
请求体
NotificationChannelCreateRequest:
| Name | Type | Required | In | Description |
|---|---|---|---|---|
institutionBizId | string | Yes | body | 机构业务 ID(最多 64 个字符) |
channelName | string | Yes | body | 渠道名称(最多 255 个字符) |
channelRemark | string | No | body | 渠道备注(最多 255 个字符) |
channelHost | string | Yes | body | 渠道主机/访问端点(最多 512 个字符) |
channelCategory | string | Yes | body | 渠道类别枚举:EMAIL |
emailConfig | object | No | body | 邮箱配置(当 channelCategory 为 EMAIL 时必填) |
emailConfig.smtpHost | string | Yes | body | SMTP 服务器主机名 |
emailConfig.smtpPort | integer | Yes | body | SMTP 服务器端口(1-65535) |
emailConfig.senderEmail | string | Yes | body | 发件人邮箱地址 |
emailConfig.senderName | string | Yes | body | 发件人显示名称 |
emailConfig.username | string | Yes | body | SMTP 认证用户名 |
emailConfig.password | string | Yes | body | SMTP 认证密码 |
emailConfig.useSsl | boolean | No | body | 是否使用 SSL 加密(默认值:true) |
emailConfig.useStartTls | boolean | No | body | 是否使用 STARTTLS(默认值:false) |
emailConfig.connectionTimeout | integer | No | body | 连接超时时间(毫秒,默认值:10000) |
emailConfig.readTimeout | integer | No | body | 读取超时时间(毫秒,默认值:30000) |
成功响应
成功200
{
"code": "2000",
"message": "SUCCESS",
"data": {
"bizId": "ch_abc123",
"institutionBizId": "inst_abc123",
"channelName": "Main Email",
"channelRemark": null,
"channelHost": "smtp.example.com",
"channelCategory": "EMAIL",
"channelStatus": "PENDING",
"emailConfig": {
"smtpHost": "smtp.example.com",
"smtpPort": 587,
"senderEmail": "noreply@example.com",
"senderName": "Acme Corp",
"username": "noreply@example.com",
"password": "******",
"useSsl": true,
"useStartTls": false,
"connectionTimeout": 10000,
"readTimeout": 30000
},
"createdAt": "2026-03-21T00:00:00Z",
"updatedAt": "2026-03-21T00:00:00Z",
"createdBy": "user_xyz",
"updatedBy": "user_xyz"
}
}错误响应
| 错误码 | 描述 |
|---|---|
4000 | 校验错误(缺少必填字段,无效的邮箱配置) |
4010 | 未授权(无效或缺少 JWT token) |
4030 | Turnstile 验证失败 |
说明
- 出于安全考虑,响应中密码以
******脱敏显示。 - 当
channelCategory为EMAIL时,emailConfig对象为必填。 - 渠道初始以
PENDING状态创建。