Skip to content
Skillpedia
PDF, Word & slides32k Β· #9173

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.md

Copy 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

Use this skill to help me: https://github.com/googleworkspace/cli/blob/main/skills/gws-gmail-watch/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

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.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

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

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills