Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
googleworkspace avatar

Gws Gmail Watch

  • 30.4k installs
  • 30k repo stars
  • Updated July 22, 2026
  • googleworkspace/cli

gws is a CLI that exposes all Google Workspace APIs (Gmail, Drive, Calendar, Sheets, Chat) with structured JSON output and agent skills.

About

gws is a unified CLI for all Google Workspace APIs (Gmail, Drive, Calendar, Sheets, Chat) built for humans and AI agents. It dynamically reads Google's Discovery Service to auto-generate the command surface, so it stays current as Google adds new endpoints. Every response is structured JSON, making it natural to pair with agent skills included in the distribution.

  • Dynamic API surface reads Google Discovery Service at runtime - auto-updates as Google adds endpoints
  • 40+ included agent skills pair with LLMs to manage Gmail, Drive, Calendar, Sheets without custom tooling
  • Structured JSON output and --dry-run preview for both humans and AI agents

Gws Gmail Watch by the numbers

  • 30,354 all-time installs (skills.sh)
  • +924 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #27 of 690 Office & Documents skills by installs in the Skillselion catalog
  • Security screen: MEDIUM risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

gws-gmail-watch capabilities & compatibility

Works with
gmail · google drive
Use cases
orchestration
npx skills add https://github.com/googleworkspace/cli --skill gws-gmail-watch

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs30.4k
repo stars30k
Security audit2 / 3 scanners passed
Last updatedJuly 22, 2026
Repositorygoogleworkspace/cli

How do you stream Gmail events as NDJSON?

CLI access to Google Workspace (Gmail, Drive, Calendar, Sheets) with structured JSON for agent automation.

Who is it for?

Developers automating Gmail triage with the gws CLI and GCP Pub/Sub who need machine-readable mailbox events.

Skip if: Developers who only need one-off message reads or lack gws auth and a configured GCP project should skip gws-gmail-watch.

When should I use this skill?

User asks to watch Gmail, stream new emails, or pipe mailbox events into an agent workflow with gws.

What you get

Continuous NDJSON stream of Gmail watch events, optional Pub/Sub subscription wiring

  • NDJSON Gmail event stream
  • Pub/Sub subscription linkage

By the numbers

  • Skill metadata version 0.22.5
  • Requires the gws CLI binary

Files

SKILL.mdMarkdownGitHub ↗

gmail +watch

PREREQUISITE: Read ../gws-shared/SKILL.md for auth, global flags, and security rules. If missing, run gws generate-skills to create it.

Watch for new emails and stream them as NDJSON

Usage

gws gmail +watch

Flags

FlagRequiredDefaultDescription
--projectGCP project ID for Pub/Sub resources
--subscriptionExisting Pub/Sub subscription name (skip setup)
--topicExisting Pub/Sub topic with Gmail push permission already granted
--label-idsComma-separated Gmail label IDs to filter (e.g., INBOX,UNREAD)
--max-messages10Max messages per pull batch
--poll-interval5Seconds between pulls
--msg-formatfullGmail message format: full, metadata, minimal, raw
--oncePull once and exit
--cleanupDelete created Pub/Sub resources on exit
--output-dirWrite 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 ./emails

Tips

  • 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

Related skills

How it compares

Choose gws-gmail-watch over manual Gmail API polling when you already use the gws CLI and want a ready-made NDJSON event stream.

FAQ

What command does gws-gmail-watch run?

gws-gmail-watch runs `gws gmail +watch`, which watches for new Gmail messages and prints each event as NDJSON on stdout. Consult `gws gmail +watch --help` for flags such as `--project` and `--subscription`.

What prerequisites does gws-gmail-watch need?

gws-gmail-watch requires the `gws` CLI binary and the gws-shared SKILL.md for OAuth and security rules. For Pub/Sub-backed watches, supply a GCP `--project` ID or an existing `--subscription` name.

Is Gws Gmail Watch safe to install?

skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.