全部產品
Search
文件中心

Chat App Message Service:SendChatappMessage

更新時間:Jul 14, 2026

傳送 ChatApp 訊息。

介面說明

QPS 限制

本介面的單一使用者 QPS 限制為 250 次/秒。超過限制時,API 呼叫會被限流,這可能會影響您的業務,請合理呼叫。

狀態變更

訊息傳送狀態可以透過 MNS/HTTP 方式監聽,詳細資訊請參閱回執訊息

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

cams:SendChatappMessage

create

*All Resource

*

請求參數

名稱

類型

必填

描述

樣本值

ChannelType

string

通道類型。取值:

  • whatsapp

  • messenger

  • instagram

  • telegram

  • viber

whatsapp

Type

string

訊息類型。取值:

  • template:在主控台已被審核通過的訊息範本,可以在任意時間傳送。

  • message:任意格式的訊息,時間限制為在收到使用者最後一條訊息後的 24 小時內可傳送此類訊息。

重要 當 Type 為 template 時,必須設定 TemplateCode;當 Type 為 message 時,必須設定 MessageType。

message

MessageType

string

當 Type 為 message 時,指定訊息的詳細類型。取值:

WHATSAPP

  • text:文字訊息。

  • image:圖片訊息。

  • video:影片訊息。

  • audio:音訊訊息。

  • document:文件訊息。

  • interactive:互動訊息。

  • location:位置訊息。

  • contacts:聯絡人訊息。

  • reaction:reaction 回應訊息。

  • sticker:sticker 訊息。

  • typing_indicator:打字效果訊息。

  • pin:置頂、取消置頂訊息(群組訊息專用)。

  • carousel:輪播訊息。

VIBER

  • text:文字訊息。

  • image:圖片訊息。

  • text_image_button:文字 + 圖片 + 按鈕訊息。

  • text_button:文字 + 按鈕訊息。

  • document:檔案訊息。

  • video:影片訊息。

  • text_video:文字 + 影片訊息。

  • text_video_button:文字 + 影片 + 按鈕訊息。

  • text_image:文字 + 圖片訊息。

MESSENGER / INSTAGRAM

  • text:文字訊息。

  • image:圖片訊息。

  • video:影片訊息。

  • document:檔案訊息。

  • audio:音訊訊息。

  • interactive:interactive 訊息。

  • couponTemplate:優惠券範本訊息。

  • regularTemplate:常規範本訊息。

  • quickReply:快速回覆訊息。

  • buttonTemplate:按鈕範本訊息。

TELEGRAM

  • text:文字訊息。

  • image:圖片訊息。

  • video:影片訊息。

  • audio:音訊訊息。

  • document:檔案訊息。

  • location:地址訊息。

  • gif:動態圖訊息。

  • sticker:sticker 訊息。

text

TemplateCode

string

範本編碼。通道管理>管理>範本設計介面查看範本編碼。

1119***************

Language

string

語言。詳細語言代碼清單,請參閱語言代碼

en

From

string

傳送方號碼。

  • 當 ChannelType 為 whatsapp 時為註冊並綁定 WhatsApp 的電話號碼。在通道管理>管理>WABA 管理>號碼管理介面查看。

  • 當 ChannelType 為 messenger 時為公共主頁 ID(Page ID)。在通道管理>管理>公共主頁介面查看。

  • 當 ChannelType 為 instagram 時為 Instagram 專業帳戶 ID(Account ID)。在通道管理>管理>專業帳戶介面查看。

  • 當 ChannelType 為 viber 時為 Viber 服務號 ID(Service ID)。在通道管理>管理>服務號管理介面查看。

861387777****

To

string

接收方號碼。

  • 當 ChannelType 為 whatapp 時為訊息接收方的電話號碼。

  • 當 ChannelType 為 messenger 時為與 Facebook 頁面訊息互動時產生的一個 Page-Scoped User ID。

  • 當 ChannelType 為 instagram 時為使用者與 Instagram 商業帳號或創作者帳號訊息互動時產生的 Instagram User ID。

  • 當 ChannelType 為 viber 時為訊息接收方的電話號碼。

861388988****

TemplateParams

object

範本參數集合。

string

範本參數。Key-Value 格式,Key 為參數名稱,Value 為參數取值。

{ "param1": "value1", "param2": "value2" }

Content

string

訊息內容。

WhatsApp 訊息備註:

  • messageTypetext 時,text 欄位為必填,Caption 禁止填寫。

  • messageTypeimage 時,Link 必填。

  • messageTypevideo 時,Link 必填。

  • messageTypeaudio 時,Link 必填,Caption 欄位無效。

  • messageTypedocument 時,LinkFileName 欄位必填,Caption 欄位無效。

  • messageTypeinteractive 時,typeaction 欄位必填。

  • messageTypecontacts 時,name 欄位必填。

  • messageTypelocation 時,longitudelatitude 欄位必填。

  • messageTypesticker 時,Link 欄位必填,CaptionFileName 欄位無效。

  • messageTypereaction 時,messageIdemoji 欄位必填。

Messenger 訊息備註:

  • messageTypetext 時,text 欄位必填。

  • messageTypeimagevideoaudiodocument 時,link 欄位必填。

Instagram 訊息備註:

  • messageTypetext 時,text 欄位必填。

  • messageTypeimagevideoaudio 時,link 欄位必填。

Viber 訊息備註:

  • messageTypetext 時,text 欄位必填。

  • messageTypeimage 時,link 欄位必填。

  • messageTypevideo 時,linkthumbnailfileSizeduration 欄位必填。

  • messageTypedocument 時,linkfileNamefileType 欄位為必填。

  • messageTypetext_button 時,textcaptionaction 欄位為必填。

  • messageTypetext_image_button 時,textlinkcaptionaction 欄位為必填。

  • messageTypetext_video 時,textlinkthumbnailfileSizeduration 欄位為必填。

  • messageTypetext_video_button 時,textlinkthumbnailfileSizedurationcaption 欄位為必填,action 欄位不能為值。

{ "text": "hello,whatsapp", "link": "https://*******", "caption": "****", "fileName": "****" }

Payload

array

按鈕的觸發訊息集合。

payloadtext1,payloadtext2,payloadtext3

string

範本中按鈕的觸發訊息。

payloadtext

CustWabaId deprecated

string

ISV 客戶 wabaId。過時的參數,請使用 CustSpaceId,直客客戶執行個體 ID。在通道管理>介面查看。

cams-8c8*********

FallBackId

string

回落策略 ID。該參數為國際站配置參數,中國站可忽略此參數。回落策略介面查看策略 ID。

S0****

FallBackContent

string

自訂回落內容。該參數為國際站配置參數,中國站可忽略此參數。

Fallback SMS

IsvCode deprecated

string

ISV 驗證碼,用於驗證子帳號是否由 ISV 授權,已棄用,可忽略此參數。

123123******

CustSpaceId

string

ISV 子客戶的 SpaceId,直客客戶執行個體 ID。在通道管理介面查看。

cams-8c8*********

ContextMessageId

string

回覆的訊息 ID。指原來已傳送過或收到的訊息 ID。

61851ccb2f1365b16aee****

TrackingData

string

Viber 訊息類型傳入的自訂追蹤資料,此參數為國際站參數,中國站可忽略此參數。

Tracking Data

Label

string

Viber 訊息類型,此參數為國際站參數,中國站可忽略此參數。 取值:

  • pormotion:行銷、促銷類訊息。

  • transaction:通知類訊息。

promotion

Ttl

integer

Viber 訊息傳送逾時時間。此參數為國際站參數,中國站可忽略此參數。單位:秒,取值範圍 30~1209600。

50

Tag

string

標籤資訊,Viber 訊息傳送時自訂標籤資訊。

tag

TaskId

string

自訂任務 ID。

10000****

FallBackDuration

integer

回落觸發時間。此參數為國際站參數,中國站可忽略此參數。訊息在指定時間內沒有返回已到達回執訊息時進行回落,不填代表不根據此時間判斷回落,只有傳送失敗和有失敗的狀態報告時才會回落。單位:秒。最小值:60,最大值:43200。

120

ProductAction

object

商品資訊,此參數只針對 whatsapp 類型通道。即為您在 Meta 上上傳的商品資訊。

ThumbnailProductRetailerId

string

商品目錄 ID。可透過 ListProductCatalog 介面獲取。

skkks99****

Sections

array<object>

商品分類清單(最多可以有 10 個分類,30 個商品)。

array<object>

商品分類。

Title

string

分類名稱。在通道管理>管理>目錄管理>商品管理介面查看或透過 ListProduct 介面獲取。

abcd

ProductItems

array<object>

商品資訊清單。

object

商品資訊。

ProductRetailerId

string

商品 ID。在通道管理>管理>目錄管理>商品管理介面查看或通過 ListProduct 介面擷取。

ksi3****

FallBackRule

string

回落規則。此參數為國際站參數,中國站可忽略此參數。 取值:

  • undelivered:訊息不能傳送到端時進行回落(在傳送狀態時範本、參數需要驗證通過,範本被封、號碼被封等不做驗證)。參數值為空時預設使用此規則。

  • sentFailed:訊息在驗證範本、範本變數等參數時,驗證不通過也會進行回落。只會強制驗證 channelType, type, messageType, to, from(是否存在)幾個參數。

undelivered

FlowAction

object

Flow 訊息物件。

FlowActionData

object

flow 預設參數集合。

any

flow 預設參數。Key-Value 格式,Key 為參數名稱,Value 為參數取值。

{ "name": "name" }

FlowToken

string

自訂 flow token 資訊。

kde****

TemplateName

string

範本名稱。在通道管理>管理>範本設計介面查看範本名稱。

test_name

RecipientType

string

收件人類型。取值:

  • individual:個人。

  • group:群組。

individual

MessageCampaignId

string

活動訊息 ID。

說明

該參數為測試參數,未完全開放,請忽略該參數。

123123********

AdAccountId

string

Meta 廣告帳戶 ID。

說明

該參數為測試參數,未完全開放,請忽略該參數。

123123********

TokenType

string

Token 類型。

說明

該參數為測試參數,未完全開放,請忽略該參數。

bearer

Category

string

訊息類型(whatsapp direct send 直髮用)

警告 非 Meta 邀測客戶不要填這個值,否則會導致訊息傳送失敗

UTILITY

返回參數

名稱

類型

描述

樣本值

object

返回資料。

AccessDeniedDetail

string

存取被拒絕詳細資訊。

None

RequestId

string

請求 ID。

90E63D28-E31D-1EB2-8939-A94866******

Message

string

錯誤提示資訊。

User not authorized to operate on the specified resource.

Code

string

請求狀態碼。

  • 返回 OK 代表請求成功。

  • 其他錯誤碼,請參閱錯誤碼清單

OK

MessageId

string

訊息 ID。

61851ccb2f1365b16aee****

樣本

正常返回樣本

JSON格式

{
  "AccessDeniedDetail": "None",
  "RequestId": "90E63D28-E31D-1EB2-8939-A94866******",
  "Message": "User not authorized to operate on the specified resource.",
  "Code": "OK",
  "MessageId": "61851ccb2f1365b16aee****"
}

錯誤碼

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.

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情