创建消息模板,模板审核通过后可以发送消息。
接口说明
QPS 限制
本接口的单用户 QPS 限制为 50 次/秒。超过限制,API 调用会被限流,这可能会影响您的业务,请合理调用。
状态变更
模板的状态和质量变更可以通过 MNS/HTTP 方式监听,具体请参考回执消息。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
cams:CreateChatappTemplate |
create |
*全部资源
|
无 | 无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| Category |
string |
是 |
Whatsapp 模板分类:
Viber 模板分类:
|
UTILITY |
| Components |
array<object> |
是 |
消息模板组件列表。 说明
在 Category=AUTHENTICATION 时,Components 不允许出现 Type=HEADER 的节点,并且 Type=BODY 或 FOOTER 时,Text 内容应该为空。 |
|
|
array<object> |
否 |
组件列表。 |
||
| Type |
string |
是 |
组件类型。取值:
说明
|
BODY |
| Text |
string |
否 |
发送消息的文本。 说明
在 Category=AUTHENTICATION 中,此属性值为空。 |
hello whatsapp |
| Format |
string |
否 |
媒体资源类型。
|
TEXT |
| Url |
string |
否 |
素材路径。 说明
Viber 类型时图片建议大小:800px * 800px。 |
https://image.developer.aliyundoc.com |
| Caption |
string |
否 |
文件的描述。 |
这是一个视频 |
| FileName |
string |
否 |
文件的名称。 |
快递视频 |
| Buttons |
array<object> |
否 |
按钮列表,仅适用于 BUTTONS 组件。 说明
Whatsapp 按钮数量说明
|
|
|
array<object> |
否 |
按钮定义。 |
||
| Type |
string |
是 |
按钮类型。
说明
|
PHONE_NUMBER |
| Text |
string |
否 |
按钮显示的名称。 |
Call Me |
| PhoneNumber |
string |
否 |
电话号码,仅按钮类型为PHONE_NUMBER时有效。 |
+861368897**** |
| Url |
string |
否 |
点击链接按钮将访问的网址。 |
https://example.com |
| UrlType |
string |
否 |
网址类型。
|
static |
SignatureHash
deprecated
|
string |
否 |
请使用 SupportedApps 下的属性 |
wi299382 |
PackageName
deprecated
|
string |
否 |
请使用 SupportedApps 下的属性 |
com.demo |
| AutofillText |
string |
否 |
Whatsapp 模板,Category 为 AUTHENTICATION 且 Button Type 为 ONE_TAP/ZERO_TAP 时必填,Whatsap Autofill 操作的按钮文本。 |
Autofill |
| IsOptOut |
boolean |
否 |
Whatsapp 模板,在 Category 为 Marketing,并且 Button type 为 QUICK_REPLY 时有效,表示按钮为营销退订按钮,客户如果点击了此按钮,且在 ChatApp 已配置了发送控制操作,则后续 Marketing 消息则不会发送到客户。 |
false |
| CouponCode |
string |
否 |
优惠码值,只支持字母+数字,可以传入变量如$(couponCode),在发送时再传入优惠码 |
120293 |
| FlowId |
string |
否 |
Flow ID。 |
479884093605**** |
| FlowAction |
string |
否 |
Flow 数据事件类型。取值:
|
NAVIGATE |
| NavigateScreen |
string |
否 |
跳转屏,在 FlowAction=NAVIGATE 时必填。 |
DETAILS |
| SupportedApps |
array<object> |
否 |
支持的 APP 列表。 |
|
|
object |
否 |
|||
| SignatureHash |
string |
否 |
WhatsApp 模板,Category 为 AUTHENTICATION 且 Button Type 为 ONE_TAP/ZERO_TAP 时必填,表示 Whatsapp 调起应用的签名 Hash 值。 |
ieid83kdiek |
| PackageName |
string |
否 |
WhatsApp 模板,Category 为 AUTHENTICATION 且 Button Type 为 ONE_TAP/ZERO_TAP 时必填,表示 Whatsapp 调起应用的包名。 |
com.kuaidian.waimaistaff |
| ThumbUrl |
string |
否 |
Viber 带视频消息的缩略图。 |
https://cdn.multiplymall.mobiapp.cloud/yunmall/B-LM-LMALL202207130001/20220730/d712a057-a6af-4513-bbe6-7ee57ea60983.png?x-oss-process=image/resize,w_100 |
| Duration |
integer |
否 |
Viber 视频消息的视频时长(秒),取值范围为 0~600。 |
120 |
| FileType |
string |
否 |
Viber 文件消息的文件类型。 |
docx |
| CodeExpirationMinutes |
integer |
否 |
Whatsapp AUTHENTICATION 模板验证码有效期(分钟),只在 Whatsapp 类型消息,Category 为 AUTHENTICATION 并且 Component Type 为 Footer 时有效(此信息显示在 Footer 位置)。 |
5 |
| AddSecretRecommendation |
boolean |
否 |
Whatsapp 类型模板,Category 为 AUTHENTICATION 且 Component Type 为 Body 时有效,表示在 Body 上面显示不要将验证码信息提供给其它人的提示信息。 |
true |
| HasExpiration |
boolean |
否 |
优惠码是否存在过期时间,在 type = LIMITED_TIME_OFFER 时使用。 |
true |
| Cards |
array<object> |
否 |
Carousel 模板卡片列表。 |
|
|
array<object> |
否 |
Carousel 模板卡片对象。 |
||
| CardComponents |
array<object> |
是 |
Carousel 卡片中控件列表。 |
|
|
array<object> |
否 |
Carousel 模板中卡片对象。 |
||
| Type |
string |
是 |
组件类型。取值:
|
BODY |
| Format |
string |
否 |
媒体资源类型,在 Type = HEADER 时有效。
|
IMAGE |
| Text |
string |
否 |
Carousel 卡片中 BODY 的内容。 |
Who is the very powerful team |
| Url |
string |
否 |
素材路径。 |
https://alibaba.com/img.png |
| Buttons |
array<object> |
否 |
按钮列表,仅适用于 BUTTONS 组件。Carousel 每个卡片最多只能有两个按钮。 |
|
|
object |
否 |
按钮对象。 |
||
| Text |
string |
否 |
按钮文本。 |
Call me |
| Type |
string |
是 |
按钮类型。
|
PHONE_NUMBER |
| Url |
string |
否 |
点击按钮后将访问的网址。 |
https://alibaba.com/xx |
| UrlType |
string |
否 |
网址类型
|
static |
| PhoneNumber |
string |
否 |
电话号码。 |
+86138007**** |
| Name |
string |
是 |
模板名称。 |
hello_whatsapp |
| Language |
string |
是 |
模板语言。 详细语言代码,请参见语言代码。 |
en |
| Example |
object |
否 |
创建模板的示例。 |
hello_whatsapp |
|
string |
否 |
创建模板的示例。 |
StringConcat('a', 'b', 'c') |
|
| TemplateType |
string |
是 |
模板类型。
|
|
CustWabaId
deprecated
|
string |
否 |
ISV 客户 WabaId。 说明
过时的参数,请使用 CustSpaceId。 |
65921621816**** |
| IsvCode |
string |
否 |
ISV 校验码,用于校验子账号是否由 ISV 授权。 |
skdi3kksloslikdkkdk |
| CustSpaceId |
string |
是 |
ISV 子客户的 SpaceId/直客客户实例 ID。 |
293483938849493 |
AllowCategoryChange
deprecated
|
boolean |
否 |
是否允许 facebook 自动变更模板的目录(这样能提高模板的审核通过率)此属性只对 TemplateType=WHATSAPP 有效。 重要 这个属性已被弃用,whatsapp 已不支持此属性 |
true |
| MessageSendTtlSeconds |
integer |
否 |
WhatsApp 中模板消息发送时的有效期。
|
120 |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
返回数据。 |
||
| RequestId |
string |
请求 ID。 |
90E63D28-E31D-1EB2-8939-A94866411B2D |
| Code |
string |
请求状态码。
|
OK |
| Message |
string |
错误提示信息。 |
User not authorized to operate on the specified resource. |
| Data |
object |
返回数据。 |
{"templateCode": "****4b5c79c9432497a075bdfca36bf5","templateName": "hello_whatsapp"} |
| TemplateCode |
string |
模板 Code。 |
SMS_232907**** |
| TemplateName |
string |
模板名称。 |
hello_whatsapp |
| AccessDeniedDetail |
string |
访问被拒绝详细信息。 |
None |
示例
正常返回示例
JSON格式
{
"RequestId": "90E63D28-E31D-1EB2-8939-A94866411B2D",
"Code": "OK",
"Message": "User not authorized to operate on the specified resource.",
"Data": {
"TemplateCode": "SMS_232907****",
"TemplateName": "hello_whatsapp"
},
"AccessDeniedDetail": "None"
}
错误码
|
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. | 资源不属于当前用户。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。