gws-gmail-watch
What it does
This command watches your Gmail inbox for new emails. When a new email arrives, it sends it to you as formatted text (NDJSON).
When to use it
- βWhen you want to be notified about important emails as soon as they arrive.
- βWhen automating tasks that depend on new emails (like processing orders).
- βTo monitor specific emails based on their labels.
Skill link
https://github.com/googleworkspace/cli/blob/main/skills/gws-gmail-watch/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βWatch for new emails in my inbox and let me know when one arrives.β
5 new skills a week. 1 minute to read.
How it works
It uses a Google Cloud service to get notifications for new Gmail messages. These notifications are then sent to you in a text format that other programs can easily read.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
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 |
--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 ./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
FAQ
How do I stop watching for emails?
You can stop the command by pressing Ctrl+C on your keyboard.
What happens to the emails that arrive?
They are sent as formatted text (NDJSON) to you. You can set it up to save them to files if you wish.
Do I need to set up anything in Google Cloud?
Yes, you might need to set up a Google Cloud project for the service to work. The command tries to set this up for you, but may ask for additional information.
Details
Original description by the author
Gmail: Watch for new emails and stream them as NDJSON.
repo: googleworkspace/cli
Popularity
- GitHub stars
- 32k
- Ranking position
- #9173
- License
- Apache-2.0
- Updated
- 10/6/2026
Comments
- β¦
More skills from this repository
gws-admin-reports
32kHelps your agent get activity reports from Google Workspace. It collects audit and usage data.
gws-calendar-agenda
32kHelps your agent see upcoming events across all calendars. It's useful for organizing your schedule and knowing what's coming up.
gws-calendar-insert
32kLets your agent create new events in Google Calendar. It's useful for scheduling appointments and meetings.
gws-calendar
32kAllows your agent to manage calendars and events. It's useful for organizing your life and work.
Similar skills
feishu-doc
394kHelps your agent read, create, and edit Feishu cloud documents, including text, images, and tables, using the document tool.
feishu-drive
394kLets your agent browse, organize, and comment on files in a Feishu cloud folder that has been shared with the bot.
feishu-perm
394kHelps your agent check and change who can access a Feishu file, choosing the smallest permission that meets your request.