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
必需。代理的唯一标识符。
|
请求正文
请求正文包含一个 AgentMessage
实例。
响应正文
如果成功,响应正文将包含一个新创建的 AgentMessage
实例。
授权范围
需要以下 OAuth 范围:
https://www.googleapis.com/auth/rcsbusinessmessaging
如需了解详情,请参阅 OAuth 2.0 Overview。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):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)."]]