Google Drive
The Carbon Connect enabledIntegrations
value for Google Drive is GOOGLE_DRIVE
.
Authorization Type
Carbon uses OAuth 2.0 to connect to Google workspace.
Functionality
Carbon has the ability to synchronize files and folders from Google Drive. Google Slides, Google Docs and Google Sheets are supported, along with regular text, audio, video, and image files.
Google has a limit of 10 MB per file, so a single uploaded file cannot exceed 10 MB.
Authorization Flow
Log into your Google Drive account.
Once you’ve successfully authenticated your account, you can select files directly.
Click “Select” after selecting files to grant Carbon access to files.
Configuration
Custom OAuth Credentials
- Go to
APIs and Services
>Enabled APIs and Services
in your Google Cloud console, then click on the button titledENABLE APIS AND SERVICES
and enableGoogle Drive API
andGoogle Picker API
. - Then create an
OAuth Client ID
in theCredentials section
underGoogle Drive API
. SelectWeb Application
as the Application type and give it an identifiable name for your reference.
- Add https://api.carbon.ai as the
Authorized JS origin
and https://api.carbon.ai/integrations/google as anAuthorized redirect URI
. You can also opt to use a custom CNAME record pointing to https://api.carbon.ai for theAuthorized JS Origin
andAuthorized redirect URI
. However, for theAuthorized redirect URI
the domain paths must still be/integrations/google
.
- Save the credentials. Download the credentials.json file once you save the OAuth Client ID data and share the file with Carbon.
-
Then create an
API key
in theCredentials section
underGoogle Picker API
. Restrict the application to websites and then add https://api.carbon.ai (or your custom CNAME) to the list under website restrictions. ForAPI Restrictions
, pickRestrict key
and selectGoogle Picker API
from the list. -
Save the API key. Copy the API key and share it with Carbon.
-
Configure your consent screen in the OAuth Consent Screen. Provide your App name, support email address, and brand logo. Add carbon.ai (or your custom CNAME) to
Authorized domain
.
- Click on
Add or Remove Scopes
button to add the following scopes:userinfo.profile
,userinfo.email
,drive.readonly
,drive.metadata.readonly
- If you wish to add test users, you can do so. These users will not see the “App is unverified” notification. Other users will see this alert.
- Click
Publish App
to make this app available to your end-users.
Synchronization
Syncs are triggered when end-users add or remove Google Drive files and folders via the Google Drive picker. When a user selects a folder to be synced, we auto-sync all files added to the folder as well.
You can use the resync_file
API endpoint to programmatically resync specific Google Drive files.
To sync Google Drive files on a 24-hour schedule (more frequent schedules available upon request), you can use the /update_users
endpoint. This endpoint allows organizations to customize syncing settings according to their requirements, with the option to enable syncing for all data sources using the string ‘ALL’. It’s important to note that each request supports up to 100 customer IDs.
Here’s an example illustrating how to automatically enable syncing for updated Google Drive content for specified users: