
gws-gmail-watch
โ Officialโ 29,425by Google ยท part of googleworkspace/cli
Gmail: Watch for new emails and stream them as NDJSON.
๐ฅ๐ฅโ VerifiedFreeQuick setup
๐งฐ Not standalone. This skill ships with googleworkspace/cli and only works together with that tool โ install the tool first, then add this skill.
This is the playbook your agent receives when the skill activates โ you don't need to read it to use the skill, but it's here to audit before installing.
gmail +watch
PREREQUISITE: Read
../gws-shared/SKILL.mdfor auth, global flags, and security rules. If missing, rungws generate-skillsto create it.
Watch for new emails and stream them as NDJSON
Flags
| Flag | Required | Default | Description |
|---|---|---|---|
--project | โ | โ | GCP project ID for Pub/Sub resources |
--subscription | โ | โ | Existing Pub/Sub subscription name (skip setup) |
--topic | โ | โ | Existing Pub/Sub topic with Gmail push permission already granted |
--label-ids | โ | โ | Comma-separated Gmail label IDs to filter (e.g., INBOX,UNREAD) |
--max-messages | โ | 10 | Max messages per pull batch |
--poll-interval | โ | 5 | Seconds between pulls |
--msg-format | โ | full | Gmail message format: full, metadata, minimal, raw |
--once | โ | โ | Pull once and exit |
--cleanup | โ | โ | Delete created Pub/Sub resources on exit |
--output-dir | โ | โ | Write each message to a separate JSON file in this directory |
Examples
gws gmail +watch --project my-gcp-project
gws gmail +watch --project my-project --label-ids INBOX --once
gws gmail +watch --subscription projects/p/subscriptions/my-sub
gws gmail +watch --project my-project --cleanup --output-dir ./emailsTips
- Gmail watch expires after 7 days โ re-run to renew.
- Without --cleanup, Pub/Sub resources persist for reconnection.
- Press Ctrl-C to stop gracefully.
See Also
- gws-shared โ Global flags and auth
- gws-gmail โ All send, read, and manage email commands
Copy & paste โ that's it
npx skills add googleworkspace/cli --skill "gws-gmail-watch" --full-depthRun this in your project โ your agent picks the skill up automatically.
Usage
gws gmail +watchNo common issues documented yet. If you hit a problem, the repository's GitHub Issues page is the best place to look.
Licensed under Apache-2.0โ you can use, modify, and redistribute it under that license's terms.
View the full license file on GitHub โ