模板
模板用于定义可重复使用的多渠道文本,适用于 OTP、实用通知和邀请。
不同账户使用哪些模板?
| 账户 | 模板来源 | 发送限制 |
|---|---|---|
| 合作伙伴 | 您的模板(partner_id = 您) | template_code 可选;允许自由格式正文 |
| 开发者 | 仅限开发者目录中的 approved 模板 | 必须提供 template_code,请参阅开发者文档 |
合作伙伴 API
列出
GET /api/v1/templates
创建
POST /api/v1/templates
{
"code": "payment_reminder",
"channel": "whatsapp",
"lang": "fr",
"category": "utility",
"body": "{{partner_name}}: paiement de {{amount}} {{currency}} à régler avant {{date}}."
}
提交审批
POST /api/v1/templates/{template_id}/submit
在沙盒中,提供方可能通过模拟服务立即批准。
发送时使用模板
{
"phone": "+228XXXXXXXX",
"template_code": "otp",
"vars": {
"code": "483920",
"ttl": 10
},
"lang": "fr"
}
MorisBox 会在路由前将 {{placeholders}} 渲染到 rendered_body 中。
渠道
同一个 code 和 lang 通常会针对每个渠道分别存在(whatsapp、sms、inapp)。
开发者 API
GET /api/v1/dev/templates
POST /api/v1/dev/messages # template_code required
指南:开发者账户。