跳至主要内容
Version: 1.0

Conversations API

概述

歡迎使用 PaaSoo 對話 API,這是您跨多頻道無縫客戶互動的入口!

透過這個強大的 API,您可以透過 WhatsApp、Telegram、Apple Messages for Business、Viber Business Messages 等熱門平台與您的客戶建立聯繫。

透過簡化各個頻道的溝通,Conversations API 使您能夠提供卓越的客戶體驗。

Postman

若要以互動方式探索我們的 API 端點並輕鬆發起請求,您可以前往我們的 Postman 公開集合

身份驗證

若要使用 Conversations API 的功能,您需要使用 API 令牌對您的請求進行身份驗證。

請依照以下步驟開始:

  1. 透過我們直覺化的客戶端產生唯一的 API 令牌。
  2. 在您發出的每個 API 請求的 Authorization 標頭中包含所產生的令牌。

以下是如何建構標頭:

HeaderDescriptionExample
AuthorizationYour API tokenBearer <API_TOKEN>

回應與錯誤

Paasoo 對話 API 使用標準的 HTTP 狀態碼 來表示請求的結果。 以下是供您參考的常見狀態碼的非詳盡清單。

Status codeDescription
200successful request
400bad request
401Unauthorized access
404Resource not found
5xxsomething went wrong on our end

當請求發生錯誤時,API 將以下列格式的 JSON 本文進行回應:

{
"id": <id>,
"receivedTime": <receivedTime>,
"code": <errorCode>,
"message": "<errorMessage>"
}

回應錯誤代碼詳見下文。

Http Status CodeCodeMessageResolution
4004000Validation errorCheck request body structure and ensure all required fields are present
4014001API Token is not validVerify your API token and regenerate if needed
4004002The user has unsubscribedRemove contact from campaign or wait for user to re-subscribe
4004003Your balance is not sufficient for this transactionAdd credits to your account balance
4004004Missing parametersAdd missing required fields (type, to, content, channel)
4004005Parameters are invalidCheck parameter formats, lengths, and channel compatibility (see Supported Features section)
4004006Not allowed to send free-form messagesUse approved templates (required for WhatsApp initial contact) or check channel restrictions
4004007Channel is not activatedActivate the channel in your account settings
4004010Tag not foundVerify the tag ID exists in your account
4004011Tag already existsUse a different tag name or update the existing tag
4004020Contact not foundVerify the contact ID exists in your account
4004021failover timeoutSeconds param illegalEnsure timeoutSeconds value is within valid range
4004022failover channel max sizeReduce the number of failover channels in the chain
4004023failover channel duplicateRemove duplicate channels from failover configuration
4004024Template not foundVerify the template ID and check approval status in your account
4004025Template validate error:Check template parameters and format against template definition
4004026WhatsApp Cloud API template errorThe Meta (WhatsApp) Cloud API rejected the request. The message field contains the user-facing reason from Meta (e.g. duplicate template name, invalid component).
4004051Sender is unavailableVerify WhatsApp sender is properly configured and available
5294052Too Many RequestsThe channel has been throttled, please try again later
4004053Unsupported OperationViber templates do not support modifications
4004054Unsupported OperationTemplate management for this channel is not currently supported
4004055Unsupported OperationViber template mismatch
4004060Invalid channel user IDProvide a valid WhatsApp Business-Scoped User ID (BSUID) in CC.alphanumeric format, e.g. US.DDC91135R
4044065Media not foundVerify the media ID exists and was uploaded by your account
4004066File too largeEnsure the file does not exceed the 200 MB limit
4004067Unsupported file typeUse a supported MIME type (see Media and WhatsApp Media endpoint descriptions)
4004068Media download failedVerify the URL is publicly accessible and returns a valid response
5004069Upstream provider unavailableRetry the request; if the issue persists contact support

Error Handling Best Practices:

  • Always check the code field in the response to identify the specific error
  • Log error messages for debugging and monitoring
  • Handle validation errors (4000-4007, 4010-4011, 4020-4025, 4051, 4060, 4065-4068) by correcting the request parameters before retrying
  • Monitor account balance to avoid 4003 errors
  • Refer to the Supported Features section for channel-specific constraints to prevent 4005 errors
  • Verify failover configuration parameters to avoid 4021-4023 errors

支援的功能

The following table list the features supported for each available channel.

AppleMB

FeatureContent TypeComments
TextTEXTMax 4,096 characters
Attachment (Image, Video, Document)MEDIAMax 100MB Image, Max 100MB Video, Max 100MB Document
LocationLOCATIONGeographic location sharing
QuickReplyQUICK_REPLYMax 5 choices
RichLinkRICH_LINKRich cards with image, title, description, and link
ListPickerLIST_PICKERMulti-item selection lists
TimePickerTIME_PICKERDate and time selection interface
ApplePayAPPLEMB_PAYApple Pay integration for payments
AuthenticationAPPLEMB_AUTHOAuth authentication flows
FormAPPLEMB_FORMInteractive form elements
Update MessageAPPLEMB_UPDATE_MESSAGEBusiness Updates message to mobile number
TypingIndicatorTYPING_START / TYPING_ENDShow (TYPING_START) or dismiss (TYPING_END) the typing indicator. No content body is required.
Subscribe/Unsubscribe-Subscription management
iMessageApps-iMessage app integrations

Viber

FeatureContent TypeComments
TextTEXTMax 1,000 UTF-8 characters
ImageMEDIAMax 200MB - Expected formats: .jpg, .png
VideoMEDIAMax 200MB
DocumentMEDIAMax 200MB (.doc, .docx, .rtf, .dot, .dotx, .odt, .odf, .txt, .info, .pdf, .xps, .pdax, .eps, .xls, .xlsx, .ods, .fods, .csv, .xlsm, .xltx)
Action ButtonBUTTONMax 6 buttons - 允許企業在每則訊息中僅包含一個可點擊的按鈕,可觸發 URL。詳細欄位說明請參見 content.button/ViberButton 模型。
List Message (QuickReply)QUICK_REPLY清單訊息 讓商家可以向使用者展示一個問題,並提供 2–10 個可供選擇的答案,使用者可以從中選擇一個選項進行回覆。在 24 小時有效工作階段視窗內傳送的清單訊息按 Viber 工作階段費率計費(類型碼 802),工作階段視窗外則按交易費率計費(類型碼 801)。UI 風格可透過 viber.listMessageUiType 控制(1 = 經典單選按鈕,預設;2 = 橫向按鈕,需 Viber 客戶端 27.8.2+)。詳細欄位說明請參見 content.quickReply/ViberListMessage 模型。
Carousel MessageCAROUSELHorizontal scrollable cards (multiple cards) - 輪播訊息 允許商家傳送一則包含文字和多個可自訂版塊(items)的訊息。每個版塊都可展示不同的產品或服務,並配有專屬的媒體內容和行動呼籲按鈕(call-to-action)。
TemplateTEMPLATERussia/Ukraine templates, Transactional/Promotional templates, Viber templates
OTP Verification Message-OTP 驗證訊息 允許品牌透過向客戶傳送一次性密碼(OTP)來驗證其身份。請聯絡支援團隊以取得支援的語言清單和範本 ID。

WhatsApp

FeatureContent TypeComments
TextTEXTMax 1,024 UTF-8 characters
ImageMEDIAMax 5MB (.jpg, .png)
VideoMEDIAMax 16MB (.3gp, .mp4)
AudioMEDIAMax 16MB (.aac, .amr, .m4a, .mp3, .ogg)
DocumentMEDIAMax 100MB (.txt, .xls, .xlsx, .doc, .docx, .ppt, .pptx, .pdf)
LocationLOCATIONGeographic location sharing
Interactive Reply buttonsQUICK_REPLYQuick reply buttons for user responses
Interactive CTA URL buttonBUTTONMax 3 buttons with call-to-action URLs
TemplateTEMPLATEPre-approved message templates (Marketing, Utility, Authentication, Service) - Required for initial contact
Interactive List-Interactive list picker
Sticker-Sticker support
Reaction-Message reactions

RCS/RBM

FeatureContent TypeComments
TextTEXTMax 3,072 characters
Media (Images, Videos, Documents, Audio)MEDIAMax 100MB (.ogx, .pdf, .aac, .mp3, .mpeg, .mp4, .3gp, .jpg, .gif, .png, .h263, .m4v, .m4p, .webm)
LocationLOCATIONGeographic location sharing
Suggested repliesQUICK_REPLYQuick reply suggestions for user responses
Suggested actions (Buttons)BUTTONMax 4 buttons - Dial Number, Text, Location, Web URL
Rich cardCARDRich card with single image, title, description, and buttons
Rich card carouselCAROUSELHorizontal scrollable cards (multiple cards)
Subscribe/Unsubscribe-Subscription management

Telegram

FeatureContent TypeComments
TextTEXTMax 4,096 characters
PhotoMEDIAMax 10MB
VideoMEDIAMax 50MB
AudioMEDIAMax 50MB (.mp3, .m4a)
DocumentMEDIAMax 50MB
QuickReply/KeyboardRowQUICK_REPLYQuick reply buttons for user responses
ButtonsBUTTONAction buttons with URLs or postback data

LINE

FeatureContent TypeComments
TextTEXTMax 5,000 characters
ImageMEDIAMax 10MB (.jpg, .jpeg, .png)
VideoMEDIAMax 200MB (.mp4)
AudioMEDIAMax 200MB (.m4a)
DocumentMEDIAMax 200MB
QuickReplyQUICK_REPLYMax 13 quick reply buttons for user responses
Subscribe/Unsubscribe-Follow/Unfollow events from the LINE Official Account

Notes:

  • Each channel table above includes a Content Type column showing the API content type value to use in message requests
  • Features marked with "-" in the Content Type column are channel-specific capabilities that don't map directly to the content type API parameter

Authentication

Bearer HTTP authentication. Headers-- Authorization: Bearer <TOKEN>

Security Scheme Type:

http

HTTP Authorization Scheme:

bearer

Bearer format:

auth-scheme