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:

  1. Administrator access to your Google Cloud Console
  2. Access to Google Cloud Console API & Services
  3. Ability to create Service Account credentials in Google Cloud
  4. Access to your Leena AI workspace with connector management permissions

Setting up Google Drive Connector

Step 1: Access Google Cloud Console

  1. Navigate to Google Cloud Console - Go to https://console.cloud.google.com/
  2. 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

  1. Navigate to APIs & Services:
    • In the left sidebar, click APIs & Services
    • Select Library
  2. Enable Required APIs:
    • Search for "Google Drive API"
    • Click Google Drive API
    • Click Enable
  3. 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

  1. Navigate to Credentials:

    • Go to APIs & Services > Credentials
    • Click + Create Credentials
    • Select Service Account
  2. Configure Service Account Details:

FieldDescriptionExample
Service account nameDescriptive name for the accountleena-ai-drive-service
Service account IDAuto-generated based on nameleena-ai-drive-service
DescriptionOptional descriptionService account for Leena AI Google Drive integration
  1. Grant Roles (Optional):

    • For basic functionality, you can skip role assignment
    • For advanced scenarios, consider Editor or Viewer roles
  2. Complete Creation:

    • Click Done to create the service account

Step 4: Generate Service Account Key

  1. Access Service Account:

    • On the Credentials page, find your created service account
    • Click on the service account name
  2. Create Key:

    • Go to the Keys tab
    • Click Add Key > Create new key
    • Select JSON format
    • Click Create
  3. 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:

ScopeDescriptionRequired For
https://www.googleapis.com/auth/driveFull access to Google DriveFile upload, fetch, permission updates
https://www.googleapis.com/auth/admin.directory.userUser directory accessDomain-wide delegation (optional)

Step 6: Setup Domain-Wide Delegation (Optional)

For acting on behalf of users across your domain:

  1. Enable Domain-Wide Delegation:

    • In the service account details, check Enable Google Workspace Domain-wide Delegation
    • Add a Product name for consent screen
  2. 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:

  1. 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

  1. Log in to your Leena AI workspace
  2. Navigate to Settings > Integrations
  3. Search for "Google Drive" and select it from the list to add its new connector
  4. 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:

ParameterDescriptionSource
project_idGoogle Cloud project identifierFrom JSON key file
private_key_idPrivate key identifierFrom JSON key file
private_keyRSA private key for authenticationFrom JSON key file
client_emailService account email addressFrom JSON key file
client_idService account client IDFrom JSON key file
token_uriToken endpoint URLFrom JSON key file
auth_provider_x509_cert_urlAuth provider certificate URLFrom JSON key file
client_x509_cert_urlClient certificate URLFrom JSON key file
universe_domainUniverse 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

ParameterDescriptionType
Drive TypeType of drive (My Drive, Shared Drives, or Shared with Me)Dropdown
Folder IdID of the folder where the file(s) will be uploaded. This can be identified from the URLString
FilesArray of file configurations to uploadArray

Conditional Parameters

ParameterDescriptionTypeDisplayed When
Shared Drive IdID of the shared driveStringDrive Type = "Shared Drives"

File Configuration

Each file in the Files array must contain:

ParameterDescriptionType
File FormatInput type format (S3 URL or Base64)Dropdown
File InputThe file content (URL or Base64 encoded string)String
File NameName of the file with extensionString

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

  1. Document Management: Upload reports, contracts, and documentation
  2. Media Storage: Store images, videos, and audio files
  3. Backup Operations: Automated backup of important files
  4. Content Distribution: Upload files for team sharing
  5. Data Integration: Transfer files from other systems
  6. 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

ParameterDescriptionType
Drive TypeType of drive (My Drive, Shared Drives, or Shared with Me)Dropdown
File NameName of the file to search forString
Is Exact MatchWhether to search for exact file name match (true) or partial match (false)Boolean

Optional Parameters

ParameterDescriptionType
Folder IdID 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

  1. Document Discovery: Find specific documents by name or keyword
  2. File Verification: Check if files exist before operations
  3. Content Audit: Inventory files for compliance or management
  4. Duplicate Detection: Find files with similar names
  5. Workflow Integration: Locate files for processing
  6. Backup Verification: Confirm backup files exist
  7. 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

ParameterDescriptionType
Drive TypeType of drive (My Drive, Shared Drives, or Shared with Me)Dropdown
File UrlURL of the file or folder to update permissions forString
Permission TypeType of permission to grant (domain, anyone, or user)Dropdown

Optional Parameters

ParameterDescriptionTypeDisplayed When
Shared Drive IdID of the shared driveStringDrive Type = "Shared Drives"
Files Dynamic-ui-extraWhether the file URL is provided dynamicallyBooleanUser selection
Domain RolePermission role for domain (reader, writer, commenter)DropdownPermission Type = "domain"
DomainDomain to share withStringPermission Type = "domain"
Anyone RolePermission role for anyone (reader, writer, commenter)DropdownPermission Type = "anyone"
User RolePermission role for users (reader, writer, commenter)DropdownPermission Type = "user"
User EmailsEmail addresses of users to share withArrayPermission 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

  1. Document Collaboration: Share documents with team members for editing
  2. Review Processes: Grant comment access for document reviews
  3. Public Sharing: Make documents accessible via public links
  4. Organizational Policies: Share policies across the entire domain
  5. Client Sharing: Share specific files with external clients
  6. Project Access: Control access to project-specific folders
  7. Temporary Access: Grant temporary permissions for specific tasks