Skip to content

创建通知渠道

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

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

鉴权

需要有效的 JWT token 和 Turnstile 验证。网关校验:enableJwtToken=trueenableTurnstile=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 状态创建。

内部文档