recipe-watch-drive-changes
googleworkspace/cli
Subscribe to change notifications on Google Drive files and folders via Pub/Sub.
What is recipe-watch-drive-changes?
This recipe enables real-time monitoring of Google Drive changes by setting up event subscriptions. Use it when you need to react immediately to file or folder updates without polling.
- Create event subscriptions for Google Drive file and folder changes
- Receive notifications via Google Cloud Pub/Sub topics
- List and manage active subscriptions
- Renew subscriptions before expiry to maintain continuous monitoring
- Include resource details in change notifications
How to install recipe-watch-drive-changes
npx skills add null --skill recipe-watch-drive-changes- gws-events skill installed and configured
- Google Cloud project with Pub/Sub enabled
- Drive ID and Pub/Sub topic name for the subscription
- Appropriate Google Workspace and Cloud IAM permissions
How to use recipe-watch-drive-changes
- 1.Create a subscription using gws events subscriptions create with your Drive ID, event types, and Pub/Sub topic
- 2.Verify the subscription was created by running gws events subscriptions list
- 3.Set up a consumer to listen on your Pub/Sub topic for change notifications
- 4.Monitor the subscription expiry date and renew it before expiration using gws events renew
Use cases
- Trigger automated workflows when files are modified in a shared Drive
- Monitor a folder for new uploads and process them immediately
- Sync Drive changes to an external system in real-time
- Alert team members when critical documents are updated
- Maintain an audit log of all changes to sensitive folders
- DevOps engineers setting up Drive monitoring
- Automation engineers building Drive-triggered workflows
- System administrators managing shared Drive governance
- Backend developers integrating Drive with event-driven systems
recipe-watch-drive-changes FAQ
The recipe uses google.workspace.drive.file.v1.updated events. You can modify the eventTypes array in the subscription to monitor different Drive event types.
Subscriptions have an expiry date. You must renew them before expiration using the gws events renew command to maintain continuous monitoring.
Notifications are sent to a Google Cloud Pub/Sub topic that you specify. You need to set up a subscriber to consume messages from that topic.
Yes, create separate subscriptions for each Drive or folder by specifying different targetResource values in the create command.
With includeResource set to true, notifications include the full resource details of the changed file or folder.
Full instructions (SKILL.md)
Source of truth, from googleworkspace/cli.
name: recipe-watch-drive-changes description: "Subscribe to change notifications on a Google Drive file or folder." metadata: version: 0.22.5 openclaw: category: "recipe" domain: "engineering" requires: bins: - gws skills: - gws-events
Watch for Drive Changes
PREREQUISITE: Load the following skills to execute this recipe:
gws-events
Subscribe to change notifications on a Google Drive file or folder.
Steps
- Create subscription:
gws events subscriptions create --json '{"targetResource": "//drive.googleapis.com/drives/DRIVE_ID", "eventTypes": ["google.workspace.drive.file.v1.updated"], "notificationEndpoint": {"pubsubTopic": "projects/PROJECT/topics/TOPIC"}, "payloadOptions": {"includeResource": true}}' - List active subscriptions:
gws events subscriptions list - Renew before expiry:
gws events +renew --subscription SUBSCRIPTION_ID
Related skills
More from googleworkspace/cli and the wider catalog.
gws-gmail
Send, read, and manage Gmail emails via Google Workspace CLI.
gws-drive
Manage Google Drive files, folders, and shared drives via CLI.
gws-docs
Read and write Google Docs via command line.
gws-calendar
Manage Google Calendar events, calendars, and access control via CLI.
gws-sheets
Read and write Google Sheets spreadsheets via CLI.
gws-gmail-send
Send emails via Gmail with attachments, CC/BCC, HTML support, and draft options.