gws-events-subscribe
它能做什么
这个工具可以让你实时接收 Google Workspace 服务中发生的事情的通知,比如 Google Chat 里的新消息。它会以其他程序很容易理解的格式发送这些通知。
适用场景
- ✓当某人在特定的 Google Chat 频道发布消息时收到提醒。
- ✓当共享文档中出现新动态时收到提醒。
- ✓监控日历事件的变化。
技能链接
https://github.com/googleworkspace/cli/blob/main/skills/gws-events-subscribe/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“当“Project X”Google Chat 频道里有新消息发布时通知我。”
每周 5 个新技能,1 分钟读完。
工作原理
你需要指定想接收哪个 Google Workspace 服务的通知,以及你关心哪类事件。随后,该工具会建立一个通信通道,在事件发生时把相关信息发送给你。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
events +subscribe
PREREQUISITE: Read
../gws-shared/SKILL.mdfor auth, global flags, and security rules. If missing, rungws generate-skillsto create it.
Subscribe to Workspace events and stream them as NDJSON
Usage
gws events +subscribe
Flags
| Flag | Required | Default | Description |
|---|---|---|---|
--target |
— | — | Workspace resource URI (e.g., //chat.googleapis.com/spaces/SPACE_ID) |
--event-types |
— | — | Comma-separated CloudEvents types to subscribe to |
--project |
— | — | GCP project ID for Pub/Sub resources |
--subscription |
— | — | Existing Pub/Sub subscription name (skip setup) |
--max-messages |
— | 10 | Max messages per pull batch (default: 10) |
--poll-interval |
— | 5 | Seconds between pulls (default: 5) |
--once |
— | — | Pull once and exit |
--cleanup |
— | — | Delete created Pub/Sub resources on exit |
--no-ack |
— | — | Don't auto-acknowledge messages |
--output-dir |
— | — | Write each event to a separate JSON file in this directory |
Examples
gws events +subscribe --target '//chat.googleapis.com/spaces/SPACE' --event-types 'google.workspace.chat.message.v1.created' --project my-project
gws events +subscribe --subscription projects/p/subscriptions/my-sub --once
gws events +subscribe ... --cleanup --output-dir ./events
Tips
- Without --cleanup, Pub/Sub resources persist for reconnection.
- Press Ctrl-C to stop gracefully.
[!CAUTION] This is a write command — confirm with the user before executing.
See Also
- gws-shared — Global flags and auth
- gws-events — All subscribe to google workspace events commands
常见问题
怎么停止接收通知?
按键盘上的 Ctrl+C 即可停止。如果你设置了工具自动创建临时资源,这些资源会被自动删除。
什么是“NDJSON”?
NDJSON 是一种文本格式,每一行都是一个完整、独立的 JSON 对象,计算机可以很方便地逐行读取和处理。
使用前需要先做什么设置吗?
需要。使用 Google Workspace 服务前,你要先完成身份验证和安全规则的设置。更多详情请参阅 `gws-shared/SKILL.md` 文档。
详情
作者的原始描述
Google Workspace Events: Subscribe to Workspace events and stream them as NDJSON.
repo: googleworkspace/cli
热度
- GitHub 星标
- 32k
- 排名
- #9164
- 许可证
- Apache-2.0
- 更新时间
- 2026/10/6
评论
- …