创建消息模板,模板审核通过后可以发送消息。
接口说明
QPS 限制
本接口的单用户 QPS 限制为 50 次/秒。超过限制,API 调用会被限流,这可能会影响您的业务,请合理调用。
状态变更
模板的状态和质量变更可以通过 MNS/HTTP 方式监听,具体请参考回执消息。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
cams:CreateChatappTemplate |
create |
*全部资源
|
无 | 无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| Category |
string |
是 |
模板分类 |
MARKETING |
| Components |
array<object> |
是 |
模板内容 |
|
|
array<object> |
否 |
模板内容。 |
||
| AddSecretRecommendation |
boolean |
否 |
Whatsapp 类型模板,Category 为 Authentication,并且 Component Type 为 Body 时有效,表示在 Body 上面显示不要将验证码信息提供给其它人的提示信息 |
false |
| Buttons |
array<object> |
否 |
按钮 |
|
|
array<object> |
否 |
|||
| AutofillText |
string |
否 |
Whatsapp 模板,Category 为 Authentication,并且 Button Type 为 ONE_TAP 时必填,Whatsap Autofill 操作的按钮文本 |
Autofill |
| CouponCode |
string |
否 |
优惠券码 |
23838jdjdj |
| FlowAction |
string |
否 |
flow 数据事件类型\n 取值范围:NAVIGATE/DATA_EXCHANGE |
NAVIGATE |
| FlowId |
string |
否 |
Flow id |
28383872*** |
| IsOptOut |
boolean |
否 |
Whatsapp 模板,在 Category 为 Marketing,并且 Button type 为 QUICK_REPLY 时有效,表示按钮为营销退订按钮,客户如果点击了此按钮,并且在 chatapp 平台上配置了发送控制操作,则后续 Marketing 消息则不会发送到客户 |
true |
| NavigateScreen |
string |
否 |
跳转屏 \n 在 FlowAction=NAVIGATE 时必填 |
SIGN_UP |
| PackageName |
string |
否 |
Whatsapp 模板,Category 为 Authentication,并且 Button Type 为 ONE_TAP/ZERO_TAP,表示 Whatsapp 调起应用的包名 |
com.aliyun.pack.*** |
| PhoneNumber |
string |
否 |
号码 |
8613800** |
| SignatureHash |
string |
否 |
Whatsapp 模板,Category 为 Authentication,并且 Button Type 为 ONE_TAP/ZERO_TAP,表示 Whatsapp 调起应用的签名 Hash 值 |
293882 |
| SupportedApps |
array<object> |
否 |
验证码 ONE_TAP/ZERO_TAP 支持的应用 |
|
|
object |
否 |
|||
| PackageName |
string |
否 |
Whatsapp 模板,Category 为 Authentication,并且 Button Type 为 ONE_TAP/ZERO_TAP,表示 Whatsapp 调起应用的包名 |
com.aliyun.pack.*** |
| SignatureHash |
string |
否 |
Whatsapp 模板,Category 为 Authentication,并且 Button Type 为 ONE_TAP/ZERO_TAP,表示 Whatsapp 调起应用的签名 Hash 值 |
293882 |
| Text |
string |
否 |
所发送消息的文本 |
CTA |
| TtlMinutes |
integer |
否 |
有效期 |
10800 |
| Type |
string |
是 |
按钮类型\nPHONE_NUMBER(电话),URL(网页按钮)和 QUICK_REPLY(快速回复) |
URL |
| Url |
string |
否 |
点击按钮后将访问的网址 |
https://aliyun.com |
| UrlType |
string |
否 |
网址类型 static-静态 dynamic-动态 |
static |
| Caption |
string |
否 |
描述,当 Type 为 Header,且 Format 为 IMGAGE/DOCUMENT/VIDEO 可以增加描述 |
This is a video |
| Cards |
array<object> |
否 |
Carousel 模板卡片列表 |
[] |
|
array<object> |
否 |
Carousel 模板卡片列表 |
{} |
|
| CardComponents |
array<object> |
否 |
Carousel 卡片中的控件列表 |
|
|
array<object> |
否 |
Carousel 卡片中的控件列表 |
||
| Buttons |
array<object> |
否 |
Carousel 卡片中的按钮,所有卡片中的按钮类型、名称、顺序必须一致,每个卡片最多有 2 个按钮 |
|
|
object |
否 |
|||
| PhoneNumber |
string |
否 |
号码 |
8613800** |
| Text |
string |
否 |
按钮内容 |
CTA |
| Type |
string |
是 |
Carousel 模板的按钮类型\n 取值:URL/PHONE_NUMBER/QUICK_REQLY |
URL |
| Url |
string |
否 |
点击按钮后将访问的网址 |
https://aliyun.com |
| UrlType |
string |
否 |
网址类型 static-静态 dynamic-动态 |
static |
| Format |
string |
否 |
Carousel 模板中 Header 的类型,只支持 IMAGE/VIDEO,所有卡片的 Header 必须一致\n 格式\n IMGAGE-图片 VIDEO-视频 |
IMAGE |
| Text |
string |
否 |
Carousel 轮播卡片中 Body 的内容 |
text |
| Type |
string |
是 |
组件类型\n 值:BODY、HEADER 和 BUTTONS |
BODY |
| Url |
string |
否 |
Header,图片或视频的路径 |
https://aliyun.com |
| CodeExpirationMinutes |
integer |
否 |
Whatsapp Authentication 模板验证码有效期(分钟),只在 Whatsapp 类型消息,Category 为 Authentication 并且 Component Type 为 Footer 时有效(此信息显示在 Footer 位置) |
5 |
| Duration |
integer |
否 |
Viber 视频消息的视频时长,取值范围 0 - 600 |
120 |
| FileName |
string |
否 |
文件名称,当 Type 为 Header,且 Format 为 DOCUMENT 时可以给文件指定名称 |
name.txt |
| FileType |
string |
否 |
Viber 文件消息的文件类型 |
docx |
| Format |
string |
否 |
格式\nTEXT-文本 IMGAGE-图片 DOCUMENT-文档 VIDEO-视频 |
IMAGE |
| HasExpiration |
boolean |
否 |
LTO 模板中,是否有过期时间 |
true |
| Text |
string |
否 |
所发送消息的文本 |
body |
| ThumbUrl |
string |
否 |
Viber 带视频消息的缩略图 |
https://img.png |
| Type |
string |
是 |
组件类型\n 值:BODY、HEADER、FOOTER 和 BUTTONS |
HEADER |
| Url |
string |
否 |
素材路径 |
https://img.png |
| Name |
string |
是 |
模板名称 |
test |
| Language |
string |
是 |
语言 |
en |
| Example |
object |
否 |
变量,KEY-VALUE 结构 |
{} |
|
string |
否 |
创建模板的示例,示例中可以包含一个或多个如下字段:-{"product_id":"1","have_orc":"false","platform":"ae"} |
{"product_id":"1","have_orc":"false","platform":"ae"} |
|
| TemplateType |
string |
是 |
模板类型 |
|
CustWabaId
deprecated
|
string |
否 |
ISV 客户 WabaId, 后续会被弃用,请使用 CustSpaceId |
9393*** |
IsvCode
deprecated
|
string |
否 |
Isv 校验码,用于校验子帐号是否由 ISV 授权 |
idk*** |
| CustSpaceId |
string |
否 |
ISV 子客户的 SpaceId/直客实例 ID |
cams-jd*** |
| AllowCategoryChange |
boolean |
否 |
是否允许 facebook 自动变更模板的目录(这样能提高模板的审核通过率)此属性只对 TemplateType=WHATSAPP 有效" |
false |
| MessageSendTtlSeconds |
integer |
否 |
Whatsapp 中模板消息发送时的有效期 说明
取值范围
|
62 |
| CategoryChangePaused |
boolean |
否 |
Utility 类型模板变更为 Marketing 类型时,模板暂停发送 |
true |
| ProductSetId |
string |
否 |
productSetId |
9928** |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
返回数据。 |
||
| AccessDeniedDetail |
string |
访问被拒绝详细信息。 |
None |
| Code |
string |
请求状态码。
|
OK |
| Data |
object |
返回数据。 |
|
| TemplateCode |
string |
模板 Code。 |
SMS_232907**** |
| TemplateName |
string |
模板名称。 |
hello_whatsapp |
| Message |
string |
错误提示信息。 |
User not authorized to operate on the specified resource. |
| RequestId |
string |
请求 ID。 |
90E63D28-E31D-1EB2-8939-A94866411B2D |
| Success |
boolean |
是否调用成功。取值:
|
true |
示例
正常返回示例
JSON格式
{
"AccessDeniedDetail": "None",
"Code": "OK",
"Data": {
"TemplateCode": "SMS_232907****",
"TemplateName": "hello_whatsapp"
},
"Message": "User not authorized to operate on the specified resource.",
"RequestId": "90E63D28-E31D-1EB2-8939-A94866411B2D",
"Success": true
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | Product.Unsubscript | You have not subscribed to the specified product. | 您尚未订阅指定的产品。 |
| 400 | Ram.PermissionDeny | You are not authorized to perform the operation. | 您无权执行该操作。 |
| 400 | System.LimitControl | The system is under flow control. | 系统处于流控制之下。 |
| 400 | Unknown.ResourceOwnerId | The resource does not belong to the current user. | 资源不属于当前用户。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。