Alert Center API 可以在提醒更新时发送通知。如需接收通知,您必须配置通知设置。
Pub/Sub 通知
Alert Center API 可以向 Pub/Sub 主题发布通知。创建主题并授予 alerts-api-push-notifications@system.gserviceaccount.com 发布权限后,请使用 Alert Center API 更新设置 API 将该主题设置为通知目的地。配置完成后,每次更新(例如收到新提醒时),Alert Center API 都会向该主题发布一条消息。
Pub/Sub 消息属性
以下各部分介绍了 Pub/Sub 消息中包含的属性。
常用属性
alertcenter_resource_type:资源类型。支持的值为"ALERT"。alertcenter_resource_status:资源的状态。支持的值包括"CREATED"、"DELETED"、"UNDELETED"和"MODIFIED"。alertcenter_payload_format:载荷的格式。支持的值为"JSON"。
提醒属性
alertcenter_start_time:导致此提醒的事件开始或被检测到的时间。alertcenter_end_time:导致此提醒的事件停止活跃的时间。alertcenter_type:提醒的类型。如需查看可用提醒类型的列表,请参阅 Google Workspace 提醒类型。alertcenter_source:报告相应提醒的系统的唯一标识符。alertcenter_create_time:相应提醒的创建时间。alertcenter_update_time:相应提醒的上次更新时间。
消息载荷
消息的载荷取决于 alertcenter_resource_type。如果资源类型为 "ALERT",则载荷是 Alert Center API 提醒类型之一。载荷的格式取决于 alertcenter_payload_format。如果格式为 "JSON",则载荷是 base64 编码的 JSON 对象。