Skip to content

创建通知渠道

POST/web/v1/notification-channels/command/createWEB

创建一个新的通知渠道。目前支持 EMAIL 渠道类型。

鉴权

需要有效的 JWT token 和 Turnstile 验证。Gateway 校验:enableJwtToken=true, enableTurnstile=true

请求参数

请求体

NotificationChannelCreateRequest:

NameTypeRequiredInDescription
institutionBizIdstringYesbody机构业务 ID(最长 64 字符)
channelNamestringYesbody渠道名称(最长 255 字符)
channelRemarkstringNobody渠道备注(最长 255 字符)
channelHoststringYesbody渠道主机/接入端点(最长 512 字符)
channelCategorystringYesbody渠道分类枚举:EMAIL
emailConfigobjectNobody邮箱配置(channelCategory 为 EMAIL 时必填)
emailConfig.smtpHoststringYesbodySMTP 服务器主机名
emailConfig.smtpPortintegerYesbodySMTP 服务器端口(1-65535)
emailConfig.senderEmailstringYesbody发件人邮箱地址
emailConfig.senderNamestringYesbody发件人显示名称
emailConfig.usernamestringYesbodySMTP 认证用户名
emailConfig.passwordstringYesbodySMTP 认证密码
emailConfig.useSslbooleanNobody使用 SSL 加密(默认:true)
emailConfig.useStartTlsbooleanNobody使用 STARTTLS(默认:false)
emailConfig.connectionTimeoutintegerNobody连接超时时间(毫秒,默认:10000)
emailConfig.readTimeoutintegerNobody读取超时时间(毫秒,默认: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 无效或缺失)
4030Turnstile 验证失败

说明

  • 出于安全考虑,响应中的密码以 ****** 脱敏显示。
  • channelCategoryEMAIL 时,emailConfig 对象为必填。
  • 渠道创建时初始状态为 PENDING

内部文档