domainwidedelegation.comGet it set up

Use casesDocuments and Drive

Monitoring new files in a shared Drive folder

How to track and respond to new files uploaded in a Google Drive shared folder using push notifications and incremental sync, with real-world caveats.

Who it is forWorkspace automation engineers building file intake or processing systems.
APIsDrive API
Typical scopesdrive

The problem

Teams often need to trigger workflows when new files arrive in a shared Drive folder, but relying solely on manual polling is inefficient and can cause missed or delayed processing. The Drive API offers push notifications, but these are stateful and have reliability limitations. Missing a notification or losing track of the current state can result in unprocessed files, with no built-in recovery.

How it works

  1. Use the Drive API's files.watch endpoint to register a webhook notification channel on the target folder.
  2. Store the returned startPageToken after the initial sync and use it for incremental changes tracking.
  3. On receiving push notifications, use files.list with the saved pageToken to fetch new or changed files since the last checkpoint.
  4. Periodically refresh the watch channel before it expires, and update the pageToken with each sync.
  5. Implement retry logic for failed file transfers and handle notification channel expiration events by falling back to a full folder scan using the latest saved pageToken.

What changes

File ingestion is event-driven and near real-time, with missed changes detected via incremental resync. This reduces latency and manual intervention compared to polling the folder contents.

The trap in this one. Drive push notifications (watch) are not guaranteed to fire for every new file if the watch channel expires or if the service account’s access to the folder is changed after the channel is created. If you rely on push and do not periodically resync (using incremental file list with pageToken), you will silently miss files uploaded during an outage or permission change. Engineers only notice this after discovering orphaned files weeks later, as Drive does not provide a dead-letter or missed-events log.

Questions people ask

How often should I refresh the watch channel?

Watch channels typically expire after a few days; refresh at least every 24 hours and always handle the 'stop' notification to avoid missing changes.

What happens if the service account loses access to the folder?

Notifications will silently stop and incremental syncs will fail. Always validate access before re-registering channels and during resync.

Can I guarantee zero missed files using this method?

No; you must combine push notifications with periodic full or incremental scans using the saved pageToken to account for missed events or channel interruptions.

Want this built?

This is a pattern we run in production. We will set up the delegation and build this on top of it — $500 per hour, most of it working the same day.

Talk to us Or read the setup guide

Related use cases

Create a client folder structure the moment a deal closes

Provision a consistent Drive folder tree, seeded with templates and shared with the right people, automatically.

Generate documents from a template and real data

Produce agreements, letters and reports from a Docs template with fields filled from your systems.

Sort incoming files into the right place automatically

Watch a drop folder, work out what each file is, and file it where it belongs with a consistent name.