new_releases 更新:查看
版本資訊瞭解新功能和產品更新。
Method: phones.agentMessages.create
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
將服務專員傳送的訊息傳送給使用者。
使用者必須啟用 RCS,且 RBM 平台必須能夠聯絡到使用者,代理人才能順利傳送訊息。否則,代理程式會收到 404 錯誤代碼。
如果使用者已上線,RBM 平台會立即傳送訊息。否則,RBM 平台會將訊息排入佇列,並在使用者下次上線時傳送。
RBM 平台會忽略任何使用相同代理程式傳送的先前訊息或事件 ID 傳送的代理程式訊息。
在代理程式訊息傳送和傳送完畢之間,您可以撤銷這些訊息。
HTTP 要求
POST https://rcsbusinessmessaging.googleapis.com/v1/{parent=phones/*}/agentMessages
這個網址使用 gRPC 轉碼語法。
路徑參數
參數 |
parent |
string
「phones/{E.164}」,其中 {E.164} 是使用者的電話號碼,格式為 E.164。舉例來說,如果使用美國電話號碼 +1-222-333-4444,值會是 phones/+12223334444,產生的端點則會是 https://rcsbusinessmessaging.googleapis.com/v1/phones/+12223334444/agentMessages。
|
查詢參數
參數 |
messageId |
string
必要欄位。由服務專員指派的訊息專屬 ID。這必須是 UUID,如 https://tools.ietf.org/html/rfc4122 所定義。RBM 平台會忽略任何使用相同代理程式傳送的先前訊息或事件 ID 傳送的代理程式訊息。
|
agentId |
string
必要欄位。代理程式的專屬 ID。
|
要求主體
要求主體包含 AgentMessage
的例項。
回應主體
如果成功,回應主體會包含新建立的 AgentMessage
例項。
授權範圍
需要下列 OAuth 範圍:
https://www.googleapis.com/auth/rcsbusinessmessaging
詳情請參閱 OAuth 2.0 Overview。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[[["\u003cp\u003eMessages can be sent from an agent to a user, but the user must be RCS enabled and reachable by the RBM platform, otherwise, a 404 error code is returned.\u003c/p\u003e\n"],["\u003cp\u003eThe RBM platform immediately delivers messages to online users and queues messages for offline users, delivering them when the user comes back online.\u003c/p\u003e\n"],["\u003cp\u003eThe RBM platform will ignore agent messages with duplicate message IDs that were used in prior messages or events.\u003c/p\u003e\n"],["\u003cp\u003eAgent messages are revocable between the time they are sent and delivered.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ePOST\u003c/code\u003e request to send an agent message to a user should be sent to the endpoint: \u003ccode\u003ehttps://rcsbusinessmessaging.googleapis.com/v1/{parent=phones/*}/agentMessages\u003c/code\u003e, where \u003ccode\u003eparent\u003c/code\u003e is the user's E.164 formatted phone number.\u003c/p\u003e\n"]]],[],null,["# Method: phones.agentMessages.create\n\nSends a message from the agent to a user.\n\nThe user must be RCS enabled and reachable by the RBM platform in order for the agent to successfully send a message. Otherwise, the agent receives a 404 error code.\n\nIf the user is online, the RBM platform delivers the message right away. Otherwise, the RBM platform queues the message and delivers it when the user is next online.\n\nThe RBM platform ignores any agent message sent with an ID that was used by an earlier message or event sent from the same agent.\n\nAgent messages can be revoked between the time they are sent and the time they are delivered.\n\n### HTTP request\n\n`POST https://rcsbusinessmessaging.googleapis.com/v1/{parent=phones/*}/agentMessages`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `parent` | `string` \"phones/{E.164}\", where {E.164} is the user's phone number in E.164 format. For example, with the US phone number +1-222-333-4444, the value would be phones/+12223334444, and the resulting endpoint would be \u003chttps://rcsbusinessmessaging.googleapis.com/v1/phones/+12223334444/agentMessages\u003e. |\n\n### Query parameters\n\n| Parameters ||\n|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `messageId` | `string` Required. The unique ID of the message, assigned by the agent. This must be a UUID, as defined in \u003chttps://tools.ietf.org/html/rfc4122\u003e. The RBM platform ignores any agent message sent with an ID that was used by an earlier message or event sent from the same agent. |\n| `agentId` | `string` Required. The agent's unique identifier. |\n\n### Request body\n\nThe request body contains an instance of [AgentMessage](/business-communications/rcs-business-messaging/reference/rest/v1/phones.agentMessages#AgentMessage).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [AgentMessage](/business-communications/rcs-business-messaging/reference/rest/v1/phones.agentMessages#AgentMessage).\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/rcsbusinessmessaging`\n\nFor more information, see the [OAuth 2.0 Overview](/identity/protocols/OAuth2)."]]