new_releases 更新:查看
版本说明,了解新功能和产品动态。
ServerEvent
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
在服务器端发生的与代理和用户之间的对话相关的事件。
例如,如果聊天机器人为消息设置了 TTL,并且 TTL 过期,系统会触发此事件,以通知合作伙伴聊天机器人消息已超时。
ServerEvent 显示在代理从其 Pub/Sub 订阅接收的“message”对象的“data”字段中。“data”字段是一个 base64 编码的字符串,代理必须对其进行解码才能与 ServerEvent 结构匹配。
JSON 表示法 |
{
"phoneNumber": string,
"agentId": string,
"messageId": string,
"eventType": enum (ServerEvent.EventType ),
"eventId": string,
"sendTime": string
} |
字段 |
phoneNumber |
string
涉及相应事件的用户的电话号码(采用 E.164 格式)。
|
agentId |
string
代理的唯一标识符。由 RCS Business Messaging 设置。
|
messageId |
string
与事件关联的消息的 RCS 消息 ID。
|
eventType |
enum (ServerEvent.EventType )
事件的类型。
|
eventId |
string
为相应活动实例分配的唯一活动 ID。
|
sendTime |
string (Timestamp format)
服务器发送事件的时间。 采用 RFC 3339 标准,生成的输出将始终在末尾带 Z,并使用 0、3、6 或 9 个小数位。不带“Z”的偏差时间也是可以接受的。示例:"2014-10-02T15:01:23Z" 、"2014-10-02T15:01:23.045123456Z" 或 "2014-10-02T15:01:23+05:30" 。
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-22。
[null,null,["最后更新时间 (UTC):2025-08-22。"],[[["\u003cp\u003eServerEvents are notifications about occurrences related to conversations between agents and users, such as when a bot message's TTL expires.\u003c/p\u003e\n"],["\u003cp\u003eThese events are delivered within the "data" field of a "message" object in a Pub/Sub subscription, requiring base64 decoding by the agent.\u003c/p\u003e\n"],["\u003cp\u003eEach ServerEvent contains fields such as \u003ccode\u003ephoneNumber\u003c/code\u003e, \u003ccode\u003eagentId\u003c/code\u003e, \u003ccode\u003emessageId\u003c/code\u003e, \u003ccode\u003eeventType\u003c/code\u003e, \u003ccode\u003eeventId\u003c/code\u003e, and \u003ccode\u003esendTime\u003c/code\u003e to provide specific context.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eeventType\u003c/code\u003e field specifies the type of the event, while \u003ccode\u003esendTime\u003c/code\u003e indicates the server's event dispatch time in RFC 3339 format.\u003c/p\u003e\n"],["\u003cp\u003eThe information is structured in a JSON format that contains information regarding the server event and it's corresponding data.\u003c/p\u003e\n"]]],[],null,["# ServerEvent\n\nAn event that occurred server side that is related to a conversation between an agent and a user.\n\nFor example, if the bot sets a TTL for the message and the TTL expires, this event will be fired to notify the partner that the bot message timed out.\n\nThe ServerEvent appears in the \"data\" field of the \"message\" object that the agent receives from its Pub/Sub subscription. The \"data\" field is a base64-encoded string that the agent must decode to match the ServerEvent structure.\n\n| JSON representation |\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"phoneNumber\": string, \"agentId\": string, \"messageId\": string, \"eventType\": enum (/business-communications/rcs-business-messaging/reference/rest/v1/ServerEvent.EventType), \"eventId\": string, \"sendTime\": string } ``` |\n\n| Fields ||\n|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `phoneNumber` | `string` Phone number (in E.164 format) of the user involved in the event. |\n| `agentId` | `string` The agent's unique identifier. Set by RCS Business Messaging. |\n| `messageId` | `string` The RCS message ID of the message that is associated with the event. |\n| `eventType` | `enum (`[ServerEvent.EventType](/business-communications/rcs-business-messaging/reference/rest/v1/ServerEvent.EventType)`)` Type of the event. |\n| `eventId` | `string` A unique event ID assigned for the event instance. |\n| `sendTime` | `string (`[Timestamp](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp)` format)` Time at which the server sends the event. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than \"Z\" are also accepted. Examples: `\"2014-10-02T15:01:23Z\"`, `\"2014-10-02T15:01:23.045123456Z\"` or `\"2014-10-02T15:01:23+05:30\"`. |"]]