/admin/communication/templatesCreate a message sending template for the current tenant. Supports SMS, email, and push channels. Template content can use {{variable}} or Go template syntax for variable placeholders (e.g., {{code}}), which will be replaced by variable values during sending. Templates support multiple languages (locale). References: ePrivacy Directive 2002/58/EC, CAN-SPAM Act.
Schema: dto.CreateTemplateRequest
| Field | Type | Required | Example | Constraints | Description |
|---|---|---|---|---|---|
channel |
string |
Yes | sms |
enum: `sms`, `email`, `push` | |
code |
string |
Yes | verify_code |
||
content |
string |
Yes | Your verification code is {code}, valid for 5 minutes |
||
name |
string |
Yes | Verification code template |
||
content_type |
string |
No | text |
||
description |
string |
No | Used for sending login verification codes |
||
format |
string |
No | simple |
||
subject |
string |
No | Verification code notification |
||
text_content |
string |
No | Your code is {code} |
||
variables |
array of string |
No | ['["code"]'] |
| Status | Description | Schema |
|---|---|---|
| 201 | Template created successfully, returns template details | dto.CreateTemplateResponse |
| 400 | Invalid request parameters | dto.SimpleResponse |
| 401 | Unauthenticated or invalid token | dto.SimpleResponse |
| 403 | Insufficient permissions to access this resource | dto.SimpleResponse |
| 404 | Resource not found | dto.SimpleResponse |
| 500 | Internal server error | dto.SimpleResponse |
| Field | Type | Required | Example | Constraints | Description |
|---|---|---|---|---|---|
code |
integer |
No | 0 |
||
data |
dto.MessageTemplateResponse |
No | |||
message |
string |
No | success |
Message template data
| Field | Type | Required | Example | Constraints | Description |
|---|---|---|---|---|---|
channel |
string |
No | sms |
||
code |
string |
No | verify_code |
||
content |
string |
No | Your verification code is {code}, valid for 5 minutes. |
||
content_type |
string |
No | text |
||
created_at |
string |
No | 2026-04-15T10:00:00Z |
||
description |
string |
No | Used to send login verification codes. |
||
id |
string |
No | tpl_abc123 |
||
is_active |
boolean |
No | True |
||
name |
string |
No | Verification code template |
||
subject |
string |
No | Verification code notification |
||
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 |
| Field | Type | Required | Example | Constraints | Description |
|---|---|---|---|---|---|
code |
integer |
No | |||
message |
string |
No | |||
timestamp |
string |
No |