Google Drive Push Notification Watcher for Real-Time File Changes - n8n Workflow

Leverage this advanced n8n workflow to receive real-time Google Drive file change notifications using push webhooks. Stop polling and use reliable n8n templates.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Automation specialists seeking advanced, non-polling n8n templates for cloud storage monitoring.
Users requiring immediate alerts when new documents are created or modified in a specific Google Drive or Shared Drive.
Developers who need a reliable n8n trigger for Google Drive events that bypasses the limitations of traditional polling methods.
Anyone interested in using WorkflowStaticData for robust state management within an n8n environment.

Overview

Traditional Google Drive automation often relies on continuous polling, which can be inefficient and unreliable for high-volume or critical monitoring tasks. This specialized n8n workflow provides a superior, resource-efficient solution by utilizing Google Drive's Push Notification API.

This robust n8n workflow is designed around two core flows: a scheduled registration path and a real-time listening path. The scheduled or manual flow ensures the notification channel is automatically registered and renewed every six days (since channels expire weekly). The Webhook acts as the real-time n8n trigger, capturing changes instantly as they occur, providing minimal delay and optimizing resource usage compared to a polling-based n8n node approach.

Furthermore, this n8n workflow uses the WorkflowStaticData feature for state persistence, securely managing the required lastPageToken—a critical component that bookmarks the last processed event, ensuring the next run picks up exactly where the last one left off. This makes the entire n8n automation highly reliable and idempotent.

How it Works

This complex n8n workflow operates in two distinct phases: Channel Registration/Renewal and Change Monitoring.


  1. Channel Registration & Renewal: The process begins either via the Schedule Trigger (for weekly renewal) or the First Run? Click Here! Manual Trigger.

  2. Setup & Cleanup: The Set Variables n8n node configures the specific Drive ID, channel IDs, and the dynamic webhook URL. It then attempts to stop any existing notification channel using the Stop Any Existing Notifications n8n node, ensuring a clean renewal.

  3. Registration: The n8n workflow retrieves the current StartPageToken and then uses the Register Webhook HTTP request node to call the Google Drive API (changes/watch), setting up the push notification channel.

  4. State Persistence: The registration details and the lastPageToken are saved using the Save Registration to WorkflowStaticData n8n node.

  5. Real-Time Trigger: The Webhook n8n trigger waits passively for real-time push notifications from Google Drive.

  6. Validation: Upon receiving a notification, the Get Registration From WorkflowStaticData node retrieves the expected credentials. The Is Valid Request? node validates the incoming webhook headers against the stored channelId and channelToken to ensure legitimacy.

  7. Fetching Changes: A valid request triggers the Get Changes List n8n node, which uses the stored lastPageToken to retrieve the list of changes that occurred.

  8. Token Update: Crucially, the workflow saves the new nextPageToken back to WorkflowStaticData immediately using a Code n8n node. This ensures the state is updated for the next incoming notification.

  9. Filtering and Action: The changes are split into individual items and filtered using the Filter Changed Events n8n node (e.g., excluding removals and limiting to specific file types, such as PDFs). Finally, the Get Files Details n8n node fetches rich file metadata, allowing you to perform the desired action using the final placeholder n8n node.

Installation Guide

To deploy and utilize this powerful n8n workflow template, follow these steps:


  1. Import: Import the provided n8n workflow JSON file into your n8n instance.

  2. Credentials: Ensure you have configured a Google Drive OAuth2 API credential with sufficient scope to access the target Shared Drive or specific user Drive.

  3. Configure Variables: Navigate to the Set Variables n8n node. You must customize the following placeholder values:

driveId: Replace REPLACEMEDRIVE_ID with the ID of the specific Drive you wish to monitor.
channelId and channelToken: Provide unique, custom identifiers for secure channel management.

  1. Webhooks: Ensure your n8n instance is accessible externally (via a public URL or tunneling) so Google Drive can send notifications to the Webhook n8n trigger.

  2. Initial Registration: Execute the workflow manually by clicking the First Run? Click Here! Manual Trigger n8n node. This registers the notification channel with Google Drive and initializes the WorkflowStaticData.

  3. Activate: Set the n8n workflow status to Active. Note that this workflow relies on WorkflowStaticData and functions best when running in Production mode.

Node Details

Schedule Trigger & Manual Trigger: These n8n trigger nodes manage the registration lifecycle, ensuring the notification channel is renewed weekly and allowing for easy initial setup.
Set Variables: A preparatory n8n node that defines all necessary static and dynamic parameters, including the critical webhookUrl required for Google's push notifications.
Webhook: The dedicated asynchronous n8n trigger that receives real-time POST requests from Google Drive whenever file changes are detected.
HTTP Request (Multiple Instances): Several instances of this generic n8n node are used to interface directly with the Google Drive API for tasks such as stopping old channels, getting page tokens, registering the webhook, fetching the list of changes, and retrieving detailed file metadata.
Code Node (WorkflowStaticData Management): Essential n8n nodes for state persistence. They save the webhook registration details and, most importantly, continuously update the lastPageToken, which is required by the Get Changes List n8n node to maintain continuity.
If Node (Is Valid Request?): A core flow control n8n node that validates the security headers (x-goog-channel-id, x-goog-channel-token) of the incoming webhook against stored values, protecting the n8n workflow from spurious requests.


  • Filter Node (Filter Changed Events): Used to post-process the list of changes obtained from the API, refining the results to only act on relevant events (e.g., filtering for only file creation or updates, specifically for PDF files in this n8n template).

Related n8n Workflows

Free

Nodes: 13 Nodes
Updated: December 26 2025
View all
Created by

Freelance AI Automation Engineer based in London, UK. Since 2024, my n8n templates have documented my journey into applied AI and have helped hundreds of businesses and organisations get up to speed with AI automation. Today, I continue to explore use-cases as AI evolves and occasionally upload templates which I find novel and interesting. Subscribe to the RSS Feed: https://cdn.subworkflow.ai/n8n-templates/rss.xml

Featured*