其他

recipe-watch-drive-changes

googleworkspace/cli

Subscribe to change notifications on a Google Drive file or folder.

  • 3.1万 次安装
  • 3.2万 星标
  • 收录于

安装命令

npx skills add https://github.com/googleworkspace/cli --skill recipe-watch-drive-changes

要点

Subscribe to Google Drive file and folder changes via Pub/Sub notifications.

  • Requires the gws-events skill and gws binary to execute
  • Creates event subscriptions on Drive resources with configurable notification endpoints and payload options
  • Supports subscription lifecycle management: create, list, and renew subscriptions before expiry
  • Delivers change events (file updates) to Google Cloud Pub/Sub topics for downstream processing

SKILL.md

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

  1. 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}}'
  2. List active subscriptions: gws events subscriptions list
  3. Renew before expiry: gws events +renew --subscription SUBSCRIPTION_ID