new_releases 更新:查看
版本資訊瞭解新功能和產品更新。
RBM 中的同步和非同步作業
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本文件說明 RBM 平台如何處理訊息傳送和其他 API 互動,並區分同步和非同步作業。
RBM API 互動通常會在 HTTP 層級遵循同步的請求/回應模式。不過,許多 API 呼叫的結果 (尤其是訊息傳送) 會透過 webhook 以非同步方式處理。詳情請參閱下列章節。
訊息傳送:同步要求、非同步傳送
從 API 的角度來看,系統會同步處理 phones.agentMessages.create
API 要求。向 RBM 平台提出 HTTP 要求時,伺服器幾乎會立即回應標準 HTTP 狀態碼 (例如 200 OK
或錯誤),指出是否已收到要求,以及要求是否有效。
不過,實際將訊息傳送給使用者的作業會以非同步方式處理。以下因素可能會影響這項程序:
- 收件者狀態:使用者可能處於離線狀態、電池沒電,或未啟用 RCS。
- 網路狀況:電信業者網路問題可能會導致訊息延遲送達或無法送達。
RBM 平台會透過 webhooks 以非同步方式提供訊息傳送狀態更新 (例如傳送收據和讀取回條)。因此,雖然初始 API 要求是同步的,但您應依賴非同步 Webhook 事件追蹤訊息傳送情形。請勿期待 phones.agentMessages.create
回應會立即確認提交狀態。
其他 RBM API 互動
大多數以 HTTP 為基礎的 RBM API 也使用同步的請求/回應模型運作。這些 API 會立即提供 HTTP 回應,指出要求狀態 (成功或錯誤)。不過,雖然要求是同步的,但要求所導致的動作可能會涉及非同步程序。舉例來說,對 API 呼叫的成功回應,雖然用於更新操作員資訊,但不代表更新會立即反映在所有地方,可能會有短暫的傳播延遲。
Webhook 端點:非同步事件
系統會以非同步方式將下列事件傳送至您的 webhook 端點:
- 傳入的使用者訊息:RBM 平台會將傳入的使用者訊息推送至 Webhook 端點。請務必確認內送郵件。
- 傳送和讀取收據:系統會透過 webhook 傳送訊息傳送和讀取狀態的通知。
- 對話事件:某些對話相關事件 (例如輸入指標) 會透過 webhook 傳送。
- 訊息到期和撤銷事件:RBM 平台會傳送事件,確認已過期的訊息是否已成功撤銷。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-02-10 (世界標準時間)。
[null,null,["上次更新時間:2025-02-10 (世界標準時間)。"],[[["\u003cp\u003eRBM API interactions use a synchronous request-response model at the HTTP level, providing immediate feedback on request validity.\u003c/p\u003e\n"],["\u003cp\u003eMessage delivery in the RBM platform is processed asynchronously, relying on webhooks for updates due to factors like recipient status and network conditions.\u003c/p\u003e\n"],["\u003cp\u003eWhile the initial API request for sending messages is synchronous, delivery and read receipts are provided asynchronously through webhook events.\u003c/p\u003e\n"],["\u003cp\u003eOther RBM API interactions follow a synchronous pattern for request handling, but resulting actions may involve asynchronous processes with potential delays.\u003c/p\u003e\n"],["\u003cp\u003eThe RBM platform delivers various asynchronous events, such as incoming user messages, delivery receipts, and conversation updates, through a designated webhook endpoint.\u003c/p\u003e\n"]]],[],null,["# Synchronous and asynchronous operations in RBM\n\nThis document clarifies how the RBM platform handles message sending and other\nAPI interactions, distinguishing between synchronous and asynchronous\noperations.\n\nRBM API interactions generally follow a synchronous request-response pattern at\nthe HTTP level. However, the results of many API calls, especially message\ndelivery, are handled asynchronously through webhooks. Refer to the following\nsections for details.\n\nMessage sending: Synchronous request, asynchronous delivery\n-----------------------------------------------------------\n\nThe [`phones.agentMessages.create`](/business-communications/rcs-business-messaging/reference/rest/v1/phones.agentMessages/create)\nAPI request is processed **synchronously** from the API\nperspective. When you make an HTTP request to the RBM platform, the server\nresponds almost immediately with a standard HTTP status code\n(like `200 OK` or an error) to indicate whether the request was\nreceived and is valid.\n\nHowever, the actual delivery of the message to the end user is\nprocessed **asynchronously**. The following factors can affect this process:\n\n- **Recipient status**: The user might be offline, have an empty battery, or not have RCS enabled.\n- **Network conditions**: Carrier network issues can delay or prevent message delivery.\n\nThe RBM platform provides message delivery status updates (like delivery\nreceipts and read receipts) asynchronously through\n[webhooks](/business-communications/rcs-business-messaging/guides/integrate/webhooks).\nTherefore, while the initial API request is synchronous, you should rely on\nasynchronous webhook [events](/business-communications/rcs-business-messaging/guides/build/events#agent-generated_events)\nto track message delivery. Don't expect immediate confirmation of delivery\nstatus from the\n[`phones.agentMessages.create`](/business-communications/rcs-business-messaging/reference/rest/v1/phones.agentMessages/create)\nresponse.\n\n### Other RBM API interactions\n\nMost other HTTP-based RBM APIs also operate with a synchronous request-response\nmodel. These APIs provide an immediate HTTP response that indicates the status\nof the request (success or error). However, while the request is synchronous,\nthe actions resulting from the request might involve asynchronous processes.\nFor example, a successful response to an API call to update agent information\ndoesn't mean the update is instantly reflected everywhere; there might be a\nshort propagation delay.\n\nWebhook endpoint: Asynchronous events\n-------------------------------------\n\nThe following [events](/business-communications/rcs-business-messaging/guides/build/events#agent-generated_events)\nare delivered asynchronously to your [webhook](/business-communications/rcs-business-messaging/guides/integrate/webhooks)\nendpoint:\n\n- **Incoming user messages** : The RBM platform pushes incoming user messages to your webhook endpoint. Be sure to [verify incoming messages](/business-communications/rcs-business-messaging/guides/integrate/webhooks#verify_incoming_messages).\n- **Delivery and read receipts**: Notifications of message delivery and read status are sent through webhooks.\n- **Conversation events**: Some conversation-related events, such as typing indicators, are sent through webhooks.\n- **Message expiration and revocation events**: The RBM platform sends events to confirm whether an expired message was successfully revoked."]]