Labsco
googleworkspace logo

gws-events-subscribe

โœ“ Officialโ˜… 29,425

by Google ยท part of googleworkspace/cli

Google Workspace Events: Subscribe to Workspace events and stream them as NDJSON.

๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeQuick setup
๐Ÿงฐ Not standalone. This skill ships with googleworkspace/cli and only works together with that tool โ€” install the tool first, then add this skill.

This is the playbook your agent receives when the skill activates โ€” you don't need to read it to use the skill, but it's here to audit before installing.

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

Flags

FlagRequiredDefaultDescription
--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โ€”10Max messages per pull batch (default: 10)
--poll-intervalโ€”5Seconds 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