gws-events-subscribe
What it does
This tool lets you receive real-time notifications about what's happening in Google Workspace services, like new messages in Google Chat. It sends these notifications in a format that other programs can easily understand.
When to use it
- ✓Be notified when someone posts a message in a specific Google Chat channel.
- ✓Receive alerts about new activity in a shared document.
- ✓Monitor changes in calendar events.
Skill link
https://github.com/googleworkspace/cli/blob/main/skills/gws-events-subscribe/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
“Notify me when a new message is posted in the 'Project X' Google Chat channel.”
5 new skills a week. 1 minute to read.
gws-events-subscribe: full guide
Google Workspace can tell you when something happens, but only if something is listening. Without a listener, you find out by opening Chat or Drive and looking. This skill sets up that listener. It runs the gws command-line tool, subscribes to events on a Workspace resource, and prints each event as one line of structured text (NDJSON) that your agent or a script can read straight away.
It fits people who want an agent to react to Workspace activity instead of checking by hand, for example a team lead who wants every new message in one Chat space logged. Be aware of two things: it creates Google Cloud Pub/Sub resources, so you need a GCP project, and it is marked as a write command. The agent should confirm with you before it runs.
Use cases
Log a support space
Your team handles requests in one Chat space. Subscribe to the message-created event for that space and save each event to its own file with --output-dir. At the end of the week you have one JSON file per message to search or summarize.
Test an event handler once
You are building something that reacts to Workspace events and want sample data. Run with --once to pull a single batch and exit. You can inspect the real event format without leaving a listener running in the background.
Resume a listener you set up earlier
You created a Pub/Sub subscription last week and want to read from it again. Pass its name with --subscription and the tool skips setup and reads from it. Because you did not use --cleanup, the resources were kept for exactly this.
Step by step
- 1Install the skill and the gws tool. Then read the gws-shared skill, which the SKILL.md says to read first for sign-in and security rules. If it is missing, run gws generate-skills.
- 2Sign in to Google Workspace as gws-shared describes, and have a GCP project ID ready for the Pub/Sub resources.
- 3Find the resource address you want to watch, for example //chat.googleapis.com/spaces/SPACE_ID, and the event type, for example google.workspace.chat.message.v1.created.
- 4Ask your agent to subscribe. It should show you the command and ask for confirmation, because the command creates resources.
- 5Post a test message in the space and check that a JSON line appears. Stop with Ctrl+C when you are done.
Example
What to ask
“Subscribe to new messages in the Chat space AAAA1234 using my project team-alerts-prod. Save each event as a file in ./events, pull once, and delete the Pub/Sub resources afterwards.”
What you get
The agent shows the command it plans to run, with --target, --event-types google.workspace.chat.message.v1.created, --project team-alerts-prod, --once, --output-dir ./events and --cleanup. After you confirm, it runs and reports how many events it pulled. Each event is saved as a separate JSON file in ./events.
Tips
- ✓Decide on --cleanup before you start. Without it, the Pub/Sub resources stay in your project so you can reconnect later. With it, they are deleted on exit, which is better for one-off tests.
- ✓By default the tool acknowledges messages as it reads them. If you only want to look at events without marking them as handled, add --no-ack.
- ✓The tool pulls in batches: 10 messages every 5 seconds by default. If a busy space produces events faster than that, raise --max-messages or lower --poll-interval.
- ✓Do not skip the confirmation. This command creates cloud resources in your GCP project, so check the project ID before you approve.
Alternatives
- watchers
Pick it when the source is an RSS feed, a JSON endpoint or GitHub, and you want a report of only new items, not Workspace events.
- career-ops-plugin-gmail
Pick it when your goal is collecting job links from a Gmail label into a job search pipeline, not general Workspace event streaming.
- knowledge-automation
Pick it when you want a recurring scheduled job that adds new content to a knowledge vault, instead of a live event stream.
Questions and answers
Which Workspace events can I subscribe to?
You choose them with --event-types, using CloudEvents type names such as google.workspace.chat.message.v1.created. The SKILL.md only shows a Chat example, so check Google's documentation for the types of other services.
Will it keep running in the background?
It keeps pulling until you stop it with Ctrl+C. If you add --once it pulls a single batch and exits. Without --cleanup, the Pub/Sub resources it created remain afterwards.
Can I send the events to files instead of the screen?
Yes. Use --output-dir with a folder path and the tool writes each event to its own JSON file in that folder, which is easier to search later than one long stream.
How it works
You specify which Google Workspace service you want notifications from and what type of event interests you. The tool then sets up a communication channel to send you this information as it happens.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
events +subscribe
PREREQUISITE: Read
../gws-shared/SKILL.mdfor auth, global flags, and security rules. If missing, rungws generate-skillsto create it.
Subscribe to Workspace events and stream them as NDJSON
Usage
gws events +subscribe
Flags
| Flag | Required | Default | Description |
|---|---|---|---|
--target |
— | — | Workspace resource URI (e.g., //chat.googleapis.com/spaces/SPACE_ID) |
--event-types |
— | — | Comma-separated CloudEvents types to subscribe to |
--project |
— | — | GCP project ID for Pub/Sub resources |
--subscription |
— | — | Existing Pub/Sub subscription name (skip setup) |
--max-messages |
— | 10 | Max messages per pull batch (default: 10) |
--poll-interval |
— | 5 | Seconds between pulls (default: 5) |
--once |
— | — | Pull once and exit |
--cleanup |
— | — | Delete created Pub/Sub resources on exit |
--no-ack |
— | — | Don't auto-acknowledge messages |
--output-dir |
— | — | Write each event to a separate JSON file in this directory |
Examples
gws events +subscribe --target '//chat.googleapis.com/spaces/SPACE' --event-types 'google.workspace.chat.message.v1.created' --project my-project
gws events +subscribe --subscription projects/p/subscriptions/my-sub --once
gws events +subscribe ... --cleanup --output-dir ./events
Tips
- Without --cleanup, Pub/Sub resources persist for reconnection.
- Press Ctrl-C to stop gracefully.
[!CAUTION] This is a write command — confirm with the user before executing.
See Also
- gws-shared — Global flags and auth
- gws-events — All subscribe to google workspace events commands
FAQ
How do I stop receiving notifications?
You can stop by pressing Ctrl+C on your keyboard. If you configured the tool to create temporary resources, they will be removed automatically.
What is 'NDJSON'?
NDJSON is a text format where each line is a complete, independent JSON object. It's easy for computers to read and process line by line.
Do I need to set anything up beforehand?
Yes, you need to have authentication and security rules set up for using Google Workspace services. Refer to the `gws-shared/SKILL.md` documentation for more details.
Details
Original description by the author
Google Workspace Events: Subscribe to Workspace events and stream them as NDJSON.
repo: googleworkspace/cli
Popularity
- GitHub stars
- 32k
- Ranking position
- #9164
- 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
knowledge-automation
394kHelps your agent set up a recurring job that brings new content into your Knowledge vault on a schedule, then checks that the job runs.
knowledge-source-ingest
394kHelps your agent keep a Knowledge vault current with new items from chat channels, feeds, or mailboxes, without re-adding what it already has.
benchmark
280kHelps your agent measure code speed and performance. It's useful for ensuring things are fast and finding slowness issues.