# Gws Events Subscribe > Google Workspace Events: Subscribe to Workspace events and stream them as NDJSON. Source: https://skillsagentes.com/skills/googleworkspace/cli/gws-events-subscribe Repository: https://github.com/googleworkspace/cli Author: googleworkspace License: Apache-2.0 Updated: hace 4 meses Context cost: 20 tok installed, 519 tok once triggered, 519 tok with every bundled file Bundle: 1 file, 2 KB Permissions requested: none declared ## Install ```bash npx -y skills add googleworkspace/cli --skill gws-events-subscribe --agent claude-code ``` ## What it does - Suscribe a eventos de Google Workspace y los transmite como NDJSON - Permite filtrar por recurso (--target) y por tipos CloudEvents (--event-types) - Gestiona recursos Pub/Sub, con opción de reutilizar una suscripción existente o limpiarla al salir - Puede escribir cada evento como archivo JSON separado en un directorio de salida ## Use it when - Se necesita monitorizar en tiempo real eventos de Workspace (por ejemplo mensajes de Chat) desde la CLI ## What triggers it - "Suscríbeme a los eventos de mensajes de este espacio de Chat" - "Escucha eventos de Workspace y guárdalos como NDJSON" - "Haz un pull único de eventos de esta suscripción Pub/Sub existente" ## Before you install - Requiere el binario gws, y leer primero gws-shared/SKILL.md para autenticación, flags globales y reglas de seguridad; es un comando de escritura que debe confirmarse con el usuario antes de ejecutar. ## Files - SKILL.md — 2 KB ## SKILL.md Reproduced verbatim from googleworkspace/cli under Apache-2.0. This section is the upstream document and is in English. # 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 ```bash 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 ```bash 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](../gws-shared/SKILL.md) — Global flags and auth - [gws-events](../gws-events/SKILL.md) — All subscribe to google workspace events commands --- Skills Agentes — https://skillsagentes.com/skills/googleworkspace/cli/gws-events-subscribe