The Google Drive integration allows you to link folders containing restaurant documents, menus, press kits, contracts, and other business files directly into Hiro CRM’s document library.
What You Can Do
Access shared Google Drive folders without leaving Hiro CRM
Organize documents by location, category, or type
Preview files (PDFs, images, videos) in-app
Share links to menus and marketing materials with staff
Keep documents synced automatically (changes in Drive appear in Hiro)
Perfect for multi-location businesses with centralized assets
Use Cases
Menus : Current food and beverage menus by season
Press Kits : Photos, logos, and media resources
Contracts : Supplier agreements, rental contracts
Training Manuals : Staff onboarding documents
Dossiers : Hotel property information, event spaces
Marketing Collateral : Flyers, social media graphics
Prerequisites
Google Cloud Project
Create a project in Google Cloud Console
Enable Drive API
Enable the Google Drive API for your project
API Key or OAuth
Generate an API key (for public folders) or OAuth credentials (for private folders)
Shared Folders
Ensure your Drive folders are shared with appropriate permissions
Setup
Option 1: API Key (Public Folders - Recommended)
Best for folders shared with “Anyone with the link” (no sign-in required).
Create Google Cloud Project
Enable Drive API
Go to APIs & Services > Library
Search for “Google Drive API”
Click Enable
Create API Key
Go to APIs & Services > Credentials
Click Create Credentials > API Key
Copy the key
(Optional) Restrict the key to Google Drive API only
Share Your Folders
In Google Drive, right-click your folder
Click Share > Get link
Set to Anyone with the link > Viewer
Copy the folder ID from the URL
Option 2: OAuth (Private Folders)
Required for folders that aren’t publicly shared.
Create OAuth Client
Go to APIs & Services > Credentials
Click Create Credentials > OAuth client ID
Choose Web application
Add authorized redirect URI: https://yourdomain.com/api/auth/google/callback
Download the JSON credentials
Get Refresh Token
Use Google OAuth Playground or your app’s OAuth flow
Request scope: https://www.googleapis.com/auth/drive.readonly
Exchange authorization code for refresh token
.env.local (API Key Method)
.env.local (OAuth Method)
.env.example
# Google Drive Integration (Public Folders)
GOOGLE_DRIVE_API_KEY = AIzaSyXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
If using OAuth, never commit GOOGLE_CLIENT_SECRET or GOOGLE_DRIVE_REFRESH_TOKEN to version control.
API Reference
List Folder Contents
import { listDriveFolderContent } from '@/app/actions/google-drive-api' ;
const result = await listDriveFolderContent (
'1aBcDeFgHiJkLmNoPqRsTuVwXyZ' , // Folder ID
accessToken // Optional: for private folders
);
if ( result . success ) {
console . log ( 'Files:' , result . data ?. files );
console . log ( 'Folders:' , result . data ?. folders );
} else {
console . error ( 'Error:' , result . error );
}
import { getDriveFileMetadata } from '@/app/actions/google-drive-api' ;
const result = await getDriveFileMetadata ( 'file-id-here' );
if ( result . success ) {
console . log ( 'File:' , result . data ?. name );
console . log ( 'Size:' , result . data ?. size );
console . log ( 'Modified:' , result . data ?. modifiedTime );
}
Get Download URL
import { getDriveFileDownloadUrl } from '@/app/actions/google-drive-api' ;
const downloadUrl = await getDriveFileDownloadUrl ( 'file-id-here' );
// Returns: https://drive.google.com/uc?export=download&id=file-id-here
After setting up the API, add folders to your document library:
import { createGoogleDriveFolder } from '@/app/actions/google-drive-config' ;
const result = await createGoogleDriveFolder ({
title: 'Current Menus' ,
description: 'Food and beverage menus for all locations' ,
google_drive_folder_id: '1aBcDeFgHiJkLmNoPqRsTuVwXyZ' ,
folder_type: 'document' ,
location_id: 'location-uuid' , // Optional: link to specific location
is_active: true ,
is_pinned: true ,
tags: [ 'menus' , 'current' ]
});
Folder Types
general - Miscellaneous documents
photos - Image galleries
dossier - Hotel/venue information packs
manual - Training and operational manuals
document - Contracts, legal files
video - Video content
press_kit - Marketing and media resources
Data Structures
DriveFile
interface DriveFile {
id : string ; // Google Drive file ID
name : string ; // File name
mimeType : string ; // e.g., 'application/pdf'
kind : 'file' | 'folder' ; // Type
webViewLink ?: string ; // View in browser
webContentLink ?: string ; // Direct download link
thumbnailLink ?: string ; // Preview thumbnail
size ?: string ; // File size in bytes
modifiedTime ?: string ; // ISO timestamp
iconLink ?: string ; // Google's file icon
}
GoogleDriveFolderConfig
interface GoogleDriveFolderConfig {
id : string ;
title : string ;
description ?: string ;
google_drive_folder_id : string ; // The actual Drive folder ID
google_drive_url ?: string ;
location_id ?: string ; // Link to specific restaurant/hotel
folder_type : 'general' | 'photos' | 'dossier' | 'manual' | 'document' | 'video' | 'press_kit' ;
display_order : number ;
is_active : boolean ;
is_pinned : boolean ;
tags ?: string [];
}
How It Works
Folder Configuration
Admin adds Drive folder ID to Hiro CRM library
Permission Check
Hiro verifies it can access the folder (public link or OAuth)
API Request
When user opens library, Hiro fetches folder contents via Drive API
Display Files
Files and subfolders are rendered in Hiro’s UI
Preview/Download
Users can preview or download files using Google’s hosted links
Finding Your Folder ID
Open the folder in Google Drive
Look at the URL in your browser:
https://drive.google.com/drive/folders/1aBcDeFgHiJkLmNoPqRsTuVwXyZ
^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is your folder ID
Copy the ID after /folders/
Troubleshooting
Error 403: Access Denied
Causes:
Folder is not shared publicly (if using API key method)
API key doesn’t have Drive API enabled
OAuth token expired or doesn’t have drive.readonly scope
Solutions:
For public folders: Set sharing to “Anyone with the link” > “Viewer”
Verify Drive API is enabled in Google Cloud Console
Check API key restrictions (IP, HTTP referrer)
For OAuth: Regenerate refresh token with correct scopes
Error 404: Folder Not Found
Double-check the folder ID is correct
Ensure folder wasn’t deleted or moved
Verify you’re using the right Google account
Files Not Appearing
Folder may be empty
Files might be in trash
Check file permissions (need at least “Viewer” access)
Quota Exceeded
Google Drive API has usage limits:
Free tier : 20,000 requests/day
Paid tier : Higher limits available
Solutions:
Cache folder contents (don’t fetch on every page load)
Use pagination for large folders
Request quota increase in Google Cloud Console
Example Use Cases
const menuFolder = await getGoogleDriveFolders (
undefined , // All locations
undefined , // All categories
'document' // Type: document
);
const menuContents = await listDriveFolderContent (
menuFolder [ 0 ]. google_drive_folder_id
);
if ( menuContents . success ) {
const pdfMenus = menuContents . data ?. files . filter ( f =>
f . mimeType === 'application/pdf'
);
console . log ( 'Available menus:' , pdfMenus ?. map ( m => m . name ));
}
Link to Location-Specific Press Kit
const pressKits = await getGoogleDriveFolders (
'alicante-puerto-location-id' ,
undefined ,
'press_kit'
);
if ( pressKits . length > 0 ) {
const pressKitUrl = pressKits [ 0 ]. google_drive_url ;
console . log ( 'Press kit:' , pressKitUrl );
}
Create Hierarchical Library
// Main documents folder
await createGoogleDriveFolder ({
title: 'Corporate Documents' ,
google_drive_folder_id: 'main-folder-id' ,
folder_type: 'general' ,
display_order: 1 ,
is_pinned: true
});
// Location-specific menus
await createGoogleDriveFolder ({
title: 'Alicante Puerto - Menus' ,
google_drive_folder_id: 'location-menus-id' ,
folder_type: 'document' ,
location_id: 'alicante-puerto-uuid' ,
display_order: 2
});
Best Practices
Use descriptive folder names
Organize by location, category, and date
Keep folder structure shallow (max 2-3 levels)
Archive old content regularly
For sensitive files, use OAuth (private folders)
Review folder sharing settings regularly
Revoke access for former employees
Use short-lived access tokens, not permanent API keys
Use consistent file naming (e.g., “Menu_Summer_2026.pdf”)
Include dates in filenames for versioning
Remove outdated files from Drive
Use Google Drive’s version history
API Limitations
Limit Free Tier Paid Tier Requests/day 20,000 Higher (request increase) Requests/100 seconds 1,000 Higher Storage 15 GB Up to 30 TB (Workspace)
Next Steps
User Roles Learn about user roles and permissions
Multi-Location Setup Set up document access across locations