Available pre-built syncs
Nango provides several pre-built syncs for Google Drive:documents: Syncs the metadata of files and folders. Works with individual files or nested folders using the Google Picker API.folders: Syncs root-level folders from Google Drive.upload-document: Action to upload files to Google Drive.list-drives: Action to list all shared drives.folder-content: Action to fetch the contents of a specific folder.
Using the documents sync
Thedocuments sync is the most versatile option for syncing files from Google Drive. It syncs file metadata and supports filtering by specific files or folders.
Step 1: Enable the sync in Nango
- Go to your Nango dashboard
- Navigate to Integrations and select your Google Drive integration
- Go to the Syncs tab
- Enable the
documentssync - Configure the sync frequency (e.g., every 5 minutes, hourly, daily)
Step 2: Integrate the Google Picker API
Thedocuments sync works best with the Google Picker API, which provides a UI for users to select files or folders to sync.
When a user selects files or folders using the Google Picker:
- Extract the file/folder IDs from the picker response
- Pass these IDs to the sync using metadata
Step 3: Start the sync with metadata
Use the Nango SDK to start or update the sync with the selected file/folder IDs:Step 4: Access synced data
Once the sync runs, access the synced file metadata:Complete example: Nango Sample App
For a complete, production-ready implementation of Google Drive file syncing with the Google Picker API, check out the Nango Sample App. The sample app demonstrates:- Full OAuth flow with Google Drive
- Integration with the Google Picker API for file selection
- Using the
documentssync to sync selected files - Setting up webhooks for real-time updates
- Downloading and displaying files in your application
- Watch the demo video walkthrough
- View the GitHub repository
- Deploy your own instance to test
Using the folders sync
Thefolders sync is simpler and syncs all root-level folders automatically without requiring metadata:
Setting up webhooks for real-time updates
To receive real-time updates when files are synced, set up a webhook endpoint:- In your Nango dashboard, go to Settings > Webhooks
- Add your webhook URL (e.g.,
https://yourapp.com/webhooks/nango) - Subscribe to
sync.successevents
Customizing the syncs
All pre-built syncs can be extended and customized to fit your needs:- View the source code on GitHub
- Copy the sync to your project
- Modify the sync logic (add fields, change filters, etc.)
- Deploy your custom version
Additional resources
- Google Drive API Documentation
- Google Picker API Guide
- Nango Syncs Documentation
- Nango Actions Documentation