A AuthMS API Wiki API Reference iam.tianv.com →

POST /admin/communication/templates

为当前租户创建消息发送模板。支持短信、邮件、推送三种渠道,模板内容可使用 {{变量}} 或 Go template 语法定义变量占位符(如 {{code}}),后续发送时由传入的变量值替换。模板支持多语言(locale)。参考:ePrivacy Directive 2002/58/EC、CAN-SPAM Act。

通信服务 `bearerAuth` application/json

Request Body

Schema: dto.CreateTemplateRequest

FieldTypeRequiredExampleConstraintsDescription
channel string Yes sms enum: `sms`, `email`, `push`
code string Yes verify_code
content string Yes 您的验证码是{code},5分钟内有效
name string Yes 验证码模板
content_type string No text
description string No 用于发送登录验证码
format string No simple
subject string No 验证码通知
text_content string No Your code is {code}
variables array of

string

No ['["code"]']

Responses

StatusDescriptionSchema
201模板创建成功,返回模板详情dto.CreateTemplateResponse
400请求参数错误dto.SimpleResponse
401未认证或令牌无效dto.SimpleResponse
403无权访问该资源dto.SimpleResponse
404资源不存在dto.SimpleResponse
500服务内部错误dto.SimpleResponse

Referenced Schemas

dto.CreateTemplateResponse

FieldTypeRequiredExampleConstraintsDescription
code integer No 0
data dto.MessageTemplateResponse No
message string No success

dto.MessageTemplateResponse

消息模板数据

FieldTypeRequiredExampleConstraintsDescription
channel string No sms
code string No verify_code
content string No 您的验证码是{code},5分钟内有效
content_type string No text
created_at string No 2026-04-15T10:00:00Z
description string No 用于发送登录验证码
id string No tpl_abc123
is_active boolean No True
name string No 验证码模板
subject string No 验证码通知
tenant_id string No tnt_xyz789
updated_at string No 2026-04-15T10:00:00Z
variables array of

string

No ['["code"]']
version integer No 1

dto.SimpleResponse

FieldTypeRequiredExampleConstraintsDescription
code integer No
message string No
timestamp string No