Google Drive
Google Drive Connector
Overview
The Google Drive connector enables your Leena AI Agents to integrate with your organization's Google Drive platform, facilitating automated file management, document sharing, permission updates, and storage workflows.
Google Drive is Google's file storage and synchronization service that allows users to store files in the cloud, share files, and edit documents, spreadsheets, and presentations. The Google Drive connector allows Leena AI to automate file workflows, manage documents, and interact with stored content seamlessly.
Authentication
The Google Drive connector uses Service Account Authentication for secure, server-to-server communication without requiring user interaction.
Prerequisites
Before setting up the Google Drive connector, ensure you have:
- Administrator access to your Google Cloud Console
- Access to Google Cloud Console API & Services
- Ability to create Service Account credentials in Google Cloud
- Access to your Leena AI workspace with connector management permissions
Setting up Google Drive Connector
Step 1: Access Google Cloud Console
- Navigate to Google Cloud Console - Go to https://console.cloud.google.com/
- Select or Create Project:
- Select an existing project from the dropdown, or
- Click New Project to create one specifically for this integration
- Name it descriptively (e.g., "Leena AI Google Drive Integration")
Step 2: Enable Google Drive API
- Navigate to APIs & Services:
- In the left sidebar, click APIs & Services
- Select Library
- Enable Required APIs:
- Search for "Google Drive API"
- Click Google Drive API
- Click Enable
- Optional - Enable Admin Directory API (for domain-wide delegation):
- Search for "Admin SDK API"
- Click Admin SDK API
- Click Enable
Step 3: Create Service Account
-
Navigate to Credentials:
- Go to APIs & Services > Credentials
- Click + Create Credentials
- Select Service Account
-
Configure Service Account Details:
| Field | Description | Example |
|---|---|---|
| Service account name | Descriptive name for the account | leena-ai-drive-service |
| Service account ID | Auto-generated based on name | leena-ai-drive-service |
| Description | Optional description | Service account for Leena AI Google Drive integration |
-
Grant Roles (Optional):
- For basic functionality, you can skip role assignment
- For advanced scenarios, consider Editor or Viewer roles
-
Complete Creation:
- Click Done to create the service account
Step 4: Generate Service Account Key
-
Access Service Account:
- On the Credentials page, find your created service account
- Click on the service account name
-
Create Key:
- Go to the Keys tab
- Click Add Key > Create new key
- Select JSON format
- Click Create
-
Download Key File:
- The JSON key file will be automatically downloaded
- Important: Store this file securely as it contains sensitive credentials
- Rename the file to something descriptive (e.g., leena-ai-drive-service-key.json)
Step 5: Configure Required Scopes
The service account requires the following scopes for full functionality:
| Scope | Description | Required For |
|---|---|---|
| https://www.googleapis.com/auth/drive | Full access to Google Drive | File upload, fetch, permission updates |
| https://www.googleapis.com/auth/admin.directory.user | User directory access | Domain-wide delegation (optional) |
Step 6: Setup Domain-Wide Delegation (Optional)
For acting on behalf of users across your domain:
-
Enable Domain-Wide Delegation:
- In the service account details, check Enable Google Workspace Domain-wide Delegation
- Add a Product name for consent screen
-
Configure in Google Workspace Admin Console:
- Go to Google Workspace Admin Console
- Navigate to Security > API Controls > Domain-wide Delegation
- Click Add new and enter the service account's Unique ID
- Add the required scopes listed above
Step 7: Configure Shared Drive Access
For accessing shared drives:
- Add Service Account to Shared Drives:
- Go to the shared drive in Google Drive
- Click Manage members
- Add the service account email as a member
- Grant appropriate permissions (Viewer, Commenter, Editor, or Manager)
Step 8: Access the Integrations Page under Leena AI
- Log in to your Leena AI workspace
- Navigate to Settings > Integrations
- Search for "Google Drive" and select it from the list to add its new connector
- Start configuring the connector as per Step 9
Step 9: Configure Authentication in Leena AI
The Google Drive connector uses Service Account authentication. You'll need to provide the JSON key file contents:
| Parameter | Description | Source |
|---|---|---|
| project_id | Google Cloud project identifier | From JSON key file |
| private_key_id | Private key identifier | From JSON key file |
| private_key | RSA private key for authentication | From JSON key file |
| client_email | Service account email address | From JSON key file |
| client_id | Service account client ID | From JSON key file |
| token_uri | Token endpoint URL | From JSON key file |
| auth_provider_x509_cert_url | Auth provider certificate URL | From JSON key file |
| client_x509_cert_url | Client certificate URL | From JSON key file |
| universe_domain | Universe domain (default: googleapis.com) | From JSON key file |
JSON Key File Structure
Your downloaded JSON file will contain these fields:
{
"type": "service_account",
"project_id": "your-project-id",
"private_key_id": "key-id",
"private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n",
"client_email": "[email protected]",
"client_id": "1234567890",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/...",
"universe_domain": "googleapis.com"
}Access Permissions
Drive Types Supported
- My Drive: Personal Google Drive storage
- Shared Drives: Team/organizational shared drives
- Shared with Me: Files shared by other users
Required Permissions
- Read Access: View and download files
- Write Access: Upload, edit, and delete files
- Share Access: Manage file and folder permissions
- Admin Access: Manage shared drives (if applicable)
Quotas and Limitations
API Quotas
- Queries per day: 1,000,000,000 queries per day
- Queries per 100 seconds per user: 1,000
- Queries per 100 seconds: 10,000
File Limitations
- Maximum file size: 5TB per file
- Storage quota: Based on Google Workspace plan
- Upload rate: Varies based on connection and file size
Upload File/s
Uploads one or more files to Google Drive. The Agent can leverage the skill (workflow), which has been designed to upload files to Google Drive with support for multiple file formats and drive types.
Required Parameters
| Parameter | Description | Type |
|---|---|---|
| Drive Type | Type of drive (My Drive, Shared Drives, or Shared with Me) | Dropdown |
| Folder Id | ID of the folder where the file(s) will be uploaded. This can be identified from the URL | String |
| Files | Array of file configurations to upload | Array |
Conditional Parameters
| Parameter | Description | Type | Displayed When |
|---|---|---|---|
| Shared Drive Id | ID of the shared drive | String | Drive Type = "Shared Drives" |
File Configuration
Each file in the Files array must contain:
| Parameter | Description | Type |
|---|---|---|
| File Format | Input type format (S3 URL or Base64) | Dropdown |
| File Input | The file content (URL or Base64 encoded string) | String |
| File Name | Name of the file with extension | String |
Drive Type Options
- My Drive: Upload to personal Google Drive
- Shared Drives: Upload to organizational shared drives
- Shared with Me: Upload to shared folders
File Format Options
- S3 URL: File accessible via S3 URL
- Base64: File encoded in Base64 format
S3 URL Format
- Must be publicly accessible or have proper authentication
- Supports all file types
- Automatically detects MIME type
- Preserves original file metadata
Base64 Format
- Files encoded in Base64 string format
- Supports all file types
- Include proper file extensions in File Name
- No size limit beyond Google Drive quotas
Drive Selection Guidelines
My Drive
- Personal storage space
- Full control over files and folders
- Suitable for individual workflows
- Files owned by the service account
Shared Drives
- Team and organizational storage
- Shared ownership and management
- Requires service account membership
- Better for collaborative workflows
Shared with Me
- Files shared by other users
- Limited to shared folder access
- Depends on sharing permissions
- Good for collaborative uploads
Response
Upon successful upload, the action returns for each file:
- File ID in Google Drive
- File name
- File URL (sharing link)
- Upload timestamp
- File size
- MIME type
- Parent folder information
Common Use Cases
- Document Management: Upload reports, contracts, and documentation
- Media Storage: Store images, videos, and audio files
- Backup Operations: Automated backup of important files
- Content Distribution: Upload files for team sharing
- Data Integration: Transfer files from other systems
- Workflow Automation: Automated file processing and storage
Fetch Files
Searches for and retrieves files from Google Drive. This action can be leveraged by Leena AI Orchestrator/Agent to find files based on name criteria, search within specific folders, and retrieve files from different drive types.
Required Parameters
| Parameter | Description | Type |
|---|---|---|
| Drive Type | Type of drive (My Drive, Shared Drives, or Shared with Me) | Dropdown |
| File Name | Name of the file to search for | String |
| Is Exact Match | Whether to search for exact file name match (true) or partial match (false) | Boolean |
Optional Parameters
| Parameter | Description | Type |
|---|---|---|
| Folder Id | ID of the folder to search in (if not provided, searches the entire drive) | String |
Drive Type Options
- My Drive: Search in personal Google Drive
- Shared Drives: Search in organizational shared drives
- Shared with Me: Search in files shared by other users
Response
The action returns a list of files matching the search criteria. Each file includes:
Basic Information
- File ID (unique Google Drive identifier)
- File name (including extension)
- File type/MIME type
- File size
- Creation date and time
- Last modified date and time
Access Information
- Web view link (for opening in browser)
- Web content link (for downloading)
- Sharing permissions
- Owner information
Location Information
- Parent folder ID(s)
- Drive type
- Path information (when available)
Common Use Cases
- Document Discovery: Find specific documents by name or keyword
- File Verification: Check if files exist before operations
- Content Audit: Inventory files for compliance or management
- Duplicate Detection: Find files with similar names
- Workflow Integration: Locate files for processing
- Backup Verification: Confirm backup files exist
- Migration Planning: Catalog files before migration
Update Sharing Preferences
Updates the sharing permissions for a file or folder in Google Drive. The Agent can leverage the skill (workflow), which has been designed to manage access permissions and sharing settings for Google Drive files and folders.
Required Parameters
| Parameter | Description | Type |
|---|---|---|
| Drive Type | Type of drive (My Drive, Shared Drives, or Shared with Me) | Dropdown |
| File Url | URL of the file or folder to update permissions for | String |
| Permission Type | Type of permission to grant (domain, anyone, or user) | Dropdown |
Optional Parameters
| Parameter | Description | Type | Displayed When |
|---|---|---|---|
| Shared Drive Id | ID of the shared drive | String | Drive Type = "Shared Drives" |
| Files Dynamic-ui-extra | Whether the file URL is provided dynamically | Boolean | User selection |
| Domain Role | Permission role for domain (reader, writer, commenter) | Dropdown | Permission Type = "domain" |
| Domain | Domain to share with | String | Permission Type = "domain" |
| Anyone Role | Permission role for anyone (reader, writer, commenter) | Dropdown | Permission Type = "anyone" |
| User Role | Permission role for users (reader, writer, commenter) | Dropdown | Permission Type = "user" |
| User Emails | Email addresses of users to share with | Array | Permission Type = "user" |
Drive Type Options
- My Drive: Files in personal Google Drive
- Shared Drives: Files in organizational shared drives
- Shared with Me: Files shared by other users
Permission Type Options
- domain: Share with entire organization domain
- anyone: Share with anyone who has the link
- user: Share with specific users
Role Options (for all permission types)
- reader: Can view and download (equivalent to "can view")
- writer: Can edit, delete, and share (equivalent to "can edit")
- commenter: Can view and comment (equivalent to "can comment")
File URL Formats
Google Drive supports various URL formats:
Standard File URL
https://drive.google.com/file/d/{FILE_ID}/view
Folder URL
https://drive.google.com/drive/folders/{FOLDER_ID}
Direct Link URL
https://drive.google.com/open?id={FILE_ID}
Response
Upon successful permission update, the action returns:
- Permission ID (unique identifier for the permission)
- Permission type and role assigned
- Target recipients (domain, users, or anyone)
- Updated sharing settings
- Timestamp of permission change
Common Use Cases
- Document Collaboration: Share documents with team members for editing
- Review Processes: Grant comment access for document reviews
- Public Sharing: Make documents accessible via public links
- Organizational Policies: Share policies across the entire domain
- Client Sharing: Share specific files with external clients
- Project Access: Control access to project-specific folders
- Temporary Access: Grant temporary permissions for specific tasks
Updated about 20 hours ago
