gws-gmail-watch
Installation
Summary
Stream new Gmail messages as NDJSON with Pub/Sub-backed polling and optional file output.
- Monitors incoming emails via Gmail API with configurable label filtering (INBOX, UNREAD, etc.) and message format options (full, metadata, minimal, raw)
- Supports two setup modes: automatic Pub/Sub topic and subscription creation, or connection to existing resources
- Configurable polling interval, batch size, and one-time pull mode; graceful shutdown with optional resource cleanup
- Can write each message to a separate JSON file or stream directly to stdout; watch sessions expire after 7 days and must be renewed
SKILL.md
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
Usage
gws gmail +watch
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 |
Related skills
More from googleworkspace/cli
gws-gmail
Gmail: Send, read, and manage email.
26.2Kgws-docs
Read and write Google Docs.
26.1Kgws-drive
Google Drive: Manage files, folders, and shared drives.
26.0Kgws-sheets
Google Sheets: Read and write spreadsheets.
24.7Kgws-calendar
Google Calendar: Manage calendars and events.
24.6Kgws-docs-write
Google Docs: Append text to a document.
21.8K