建立訊息模板,模板審核通過後可以發送訊息。
介面說明
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. | 資源不屬於目前使用者。 |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。