Google Drive
Overview
Google Drive allows users to store files in the cloud, synchronize files across devices, and share files. Leena AI’s KM dashboard integrates with Google Drive to allow clients to pull their knowledge base from Google Drive into the Leena AI KM Dashboard. End users can then ask queries based on this knowledge base.
Integration Approach
We use a Google Service Account to establish the connection. Users use the service account key to set up the integration and share the files present in Google Drive with the Service Account email ID. This grants the Service Account access to files, allowing them to be synced with KM.
Implementation Steps
Follow the steps below to connect Google Drive with Leena AI’s KM.
STEP 1: Setting up Google Drive Service Account
-
Go to console.cloud.google.com and select or create (if you don't already have one) your GCP project.
-
Once you have selected your project, go to the Service Account section inside the IAM & Admin option.
-
Select one of the existing Service Accounts (if you already have one and it can be used—discuss this with your IT team) or create a new Service Account.
-
If creating a new Service Account: Fill in the required details in the form and click on Done.
-
Click on the Email part of your preferred/created Service account and go to the Keys section.
-
Click on Create new key to generate a new Key for the service account that will be used in the Leena KM-Google Drive Integration.
-
From the popup, select JSON and click on Create.
-
The JSON key will be automatically downloaded to your system. Save this key.
Enable Google Drive APIs Now your service account is ready. You must ensure that Google Drive APIs are enabled in your Google Cloud Project.
-
Go to the menu options and click on APIs & Services and then click on Enabled APIs & services.
-
Click on the + Enable APIs and Services button.
-
Search for Google Drive API in the search bar and select it from the results.
-
If the API is not enabled, click the ENABLE button.
STEP 1A: Authorize Service Account for Domain-Wide Delegation (Required for Permission Sync)
Note: This step is mandatory if you want to sync user and group-level permissions from Google Drive to Leena AI. Otherwise, it can be skipped.
-
Enable the Admin SDK API: In the API Library (APIs & Services > Library), search for Admin SDK API and click ENABLE.
-
Configure Domain-wide Delegation:
-
Navigate back to your Service Account (IAM & Admin > Service Accounts) and click on its email address.
-
Go to the Details tab and expand the Advanced settings section.
-
Under Domain-wide Delegation, find the Client ID and copy it.
-
Click on VIEW GOOGLE WORKSPACE ADMIN CONSOLE. This will take you to the Domain-wide Delegation page in your Google Workspace Admin console.
-
Click Add new.
-
In the Client ID field, paste the Client ID you copied from the service account.
-
In the OAuth scopes (comma-delimited) field, paste the following two scopes:
https://www.googleapis.com/auth/admin.directory.group.readonlyhttps://www.googleapis.com/auth/admin.directory.group.member.readonly
-
Click AUTHORIZE.
-
Your service account is now authorized to securely read group membership information from your Google Workspace.
STEP 2: Sharing Files with Service Account
Open your Google Drive account which contains the files that you want to sync with KM.
For Shared Drives:
- Click on Manage members (visible in the top right of your Shared Drive home page).
- Add the email ID of the Service Account and click on Share.
Note: If you want to fetch article permissions as well from Google Drive, you will have to share Editor access for the files with the service account.
- The service account will now have access to all the folders and files within the Shared Drive.
More info on access management in Shared Drives: Google Workspace Knowledge Base
Note: If you do not want to sync all the folders present in the Shared Drive and only want to sync specific folders, skip the steps above and follow the instructions below for specific folders. Kindly inform the Leena team about this, as a separate config needs to be updated to allow the sync without having member access on the Shared Drive.
For My Drive (or specific folders):
-
If you have files in My Drive (e.g., an "HR Policies" folder), click on the Share button.
-
Copy and paste the email ID of the Service Account and click on Share.
Note: If you want to fetch article permissions as well from Google Drive, you will have to share Editor access for the files with the service account.
-
Follow these steps for all the files and folders you want to share.
Note: If you share permission with any folder, all its child folders and files will be automatically shared with the same user. Check Google Support for more info.
STEP 3: Connecting Google Drive with Leena KM
-
Login into the Leena AI Dashboard and go to the Integrations section under the Settings tab.
-
Click on Connect for Google Drive.
-
Click Upload JSON File and select the service account key file you downloaded in Step 1.
-
(For Permission Sync) A toggle for Fetch Permissions will be visible.
- Enable this toggle if you want to sync user and group-level permissions for the files.
- When enabled, a new field will appear: Workspace Admin Email. Enter the email address of a Google Workspace Super Administrator. The service account will impersonate this admin user to read the group and user data required for setting permissions.
- It is preferable to have a dedicated Workspace Admin Email to avoid downtime in case of email deactivation.
-
Congratulations! Your Google Drive Integration is successfully set up.
-
To sync the articles from Google Drive to Leena AI’s KM dashboard, click on the “Sync Articles" button.
-
You can see the sync status in real-time on the same page. Once the sync is completed, the status will show Successful.
-
Content Filtering: Configure rules to control which content is synced from Google Drive. The interface allows you to define 'include' and 'exclude' rules.
- Note: Exclude rules always take precedence over include rules. Within Google Drive, you can filter content based on the file path.
FAQ: Google Drive Integration
1. What is the main purpose of this integration?
This integration lets you connect your Google Drive to Leena AI's Knowledge Management (KM) dashboard. This allows your employees to find answers from your Google Drive files (like policies, guides, etc.) by asking questions in Leena AI.
2. How does Leena AI access my files? Is it secure?
The integration is secure. It uses a Google Service Account (a special, non-human account you create in Google Cloud). You do not share any user passwords. You simply give Leena AI a "key" to this service account, and then you share your files/folders directly with the service account's email address.
3. What's the most important step for my files to be found?
You must share your Google Drive files or folders with the Service Account's email address. For Shared Drives, you must add the service account as a member. If you skip this, Leena AI will have no permission to see any files, even if the connection is active.
4. I've connected, but my files aren't showing up. What did I miss?
There are two common reasons:
- You haven't shared your files/folders with the Service Account's email (see question 3).
- You haven't run the sync yet. After connecting, you must go to the Leena AI integration page and click the "Sync Articles" button to pull the files in.
5. What is "Permission Sync" (Step 1A)? Is it mandatory?
No, it is optional.
- Turn it OFF (Default): All synced files are visible to everyone who can access the Leena AI knowledge base.
- Turn it ON: Leena AI will copy your exact Google Drive file permissions. This means only users who have access to a file in Google Drive will be able to see it in Leena AI.
6. Why does Permission Sync need a "Workspace Admin Email"?
To copy your file permissions, the service account needs to know who is in your Google Groups (e.g., "Finance Team"). It securely impersonates the admin email you provide only to read this group membership data.
7. Can I control which files sync from a folder I've shared?
Yes. The Content Filtering section allows you to set up 'include' and 'exclude' rules based on the file path. This is perfect for skipping draft folders or specific files you don't want in the knowledge base.
Updated about 13 hours ago
