PluginBench
Skill
Pass
Audit score 90

gws-events-subscribe

googleworkspace/cli

Subscribe to Google Workspace events and stream them as NDJSON for real-time event processing.

What is gws-events-subscribe?

Subscribes to Google Workspace events (e.g., Chat messages, Drive changes) and streams them as NDJSON. Use this to monitor Workspace activity, trigger automations, or build event-driven workflows.

  • Subscribe to specific Workspace resource events via CloudEvents types
  • Stream events as NDJSON for easy parsing and processing
  • Configure Pub/Sub integration with automatic or existing subscriptions
  • Batch pull events with configurable intervals and message limits
  • Optionally write each event to separate JSON files for archival
  • Auto-acknowledge messages or disable acknowledgment for custom handling

How to install gws-events-subscribe

npx skills add null --skill gws-events-subscribe
Prerequisites
  • Google Cloud project with Pub/Sub API enabled
  • GCP credentials configured (see gws-shared SKILL.md)
  • Workspace resource URI (e.g., //chat.googleapis.com/spaces/SPACE_ID)
  • CloudEvents type identifiers for target events
Claude Code
Cursor
Windsurf
Cline

How to use gws-events-subscribe

  1. 1.Run `gws events +subscribe --target '<resource-uri>' --event-types '<event-type>' --project '<gcp-project>'`
  2. 2.Monitor the NDJSON output stream for incoming events
  3. 3.Optionally use `--output-dir` to write events to separate JSON files
  4. 4.Press Ctrl-C to stop gracefully
  5. 5.Use `--cleanup` flag to delete Pub/Sub resources on exit, or omit to persist for reconnection

Use cases

Good for
  • Monitor Chat messages in real-time and trigger workflows on new messages
  • Track Drive file changes and sync them to external systems
  • Stream Calendar events for scheduling automation
  • Build audit logs by capturing all Workspace events to files
  • Integrate Workspace events into custom applications via Pub/Sub
Who it's for
  • Workspace administrators managing event-driven automations
  • Developers building integrations with Google Workspace
  • DevOps engineers setting up event monitoring and alerting
  • Teams automating workflows based on Workspace activity

gws-events-subscribe FAQ

What format are events streamed in?

Events are streamed as NDJSON (newline-delimited JSON), with one complete event object per line for easy parsing.

Do I need to set up Pub/Sub manually?

No. The skill automatically creates Pub/Sub topic and subscription unless you provide an existing subscription name via `--subscription`.

What happens if I don't use --cleanup?

Pub/Sub resources persist after the command exits, allowing you to reconnect later without recreating them.

Can I save events to files instead of streaming?

Yes, use `--output-dir <path>` to write each event as a separate JSON file in that directory.

How do I find the correct event types to subscribe to?

Event types follow CloudEvents format (e.g., `google.workspace.chat.message.v1.created`). Consult Google Workspace Events API documentation for your resource type.

Full instructions (SKILL.md)

Source of truth, from googleworkspace/cli.


name: gws-events-subscribe description: "Google Workspace Events: Subscribe to Workspace events and stream them as NDJSON." metadata: version: 0.22.5 openclaw: category: "productivity" requires: bins: - gws cliHelp: "gws events +subscribe --help"

events +subscribe

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

Subscribe to Workspace events and stream them as NDJSON

Usage

gws events +subscribe

Flags

FlagRequiredDefaultDescription
--targetWorkspace resource URI (e.g., //chat.googleapis.com/spaces/SPACE_ID)
--event-typesComma-separated CloudEvents types to subscribe to
--projectGCP project ID for Pub/Sub resources
--subscriptionExisting Pub/Sub subscription name (skip setup)
--max-messages10Max messages per pull batch (default: 10)
--poll-interval5Seconds between pulls (default: 5)
--oncePull once and exit
--cleanupDelete created Pub/Sub resources on exit
--no-ackDon't auto-acknowledge messages
--output-dirWrite 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