# Google Drive Knowledge Ingestion

This topic contains an overview of the integration steps to integrate your Aisera platform instance with your Google Drive Knowledge Article repository.

1. Create a service user. This user only needs Read permissions (with Export ability) to transfer data to the Aisera platform DB. If you plan to use Ticket Concierge, Knowledge Generation, or other features that write back to your corporate Google Drive, this user will need Read/Write permission (with Import/Export ability).\
   \
   This Aisera Service User does not need Execute or Delete permissions because all Aisera operations will be performed, tracked, and logged in the Aisera cloud.
2. Click **Settings > Integrations > New Integration** in the Aisera Admin UI.

<div align="left"><figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FIjMq2hKepuDvAsLs2pKK%2Fgdrive1.png?alt=media&#x26;token=d126572a-3586-4f3c-a404-2e2a04a9ab85" alt="" width="563"><figcaption><p>New Integration Configuration</p></figcaption></figure></div>

3. Search for **Google Drive**, select the icon, and click **Next**.

<div align="left"><figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FHsxFvJmFIbFD8z3KmfbB%2Fgdrive2.png?alt=media&#x26;token=365b6ffd-cce0-456c-a510-496c3fa2d3a3" alt="" width="563"><figcaption><p>Integration Configuration Step 2</p></figcaption></figure></div>

4. Enter the Configuration details:
5. **Name:** Enter the name of your Aisera Service Account user.
6. **Public:** Determines whether the integration can be used outside the firewall.
7. **Description:** Enter the description (Optional).
8. Click **Next.**

<div align="left"><figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FQnNxrqLt8f1itQxDZJCe%2Fgdrive3.png?alt=media&#x26;token=7b63502b-58da-4235-87b0-d50fd82485b5" alt="" width="563"><figcaption><p>Integration Authenticaation</p></figcaption></figure></div>

9. Enter the Authentication details:
10. **Authorization URL:**\
    &#x20;`https://accounts.google.com/o/oauth2/auth?scope=<scope_url>&prompt=consent&access_type=offline` \
    For the \<scope\_url> variable, choose a URL based on the level of access you want to offer. \
    \
    Here is the list: <https://developers.google.com/identity/protocols/oauth2/scopes#drive>\
    \
    For example:
    1. To crawl documents from Google Drive, set the **Scope** as: `https://www.googleapis.com/auth/drive.readonly`\
       and set the **URL** as: \
       `https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/drive.readonly&prompt=consent&access_type=offline`
    2. To use **AddFileCollaboratorAction** set the **Scope** as: `https://www.googleapis.com/auth/drive` and add the **Link** in the format: \
       `https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/drive&prompt=consent&access_type=offline`
11. You can find your **Client ID** and **Client Secret** in your Google Drive Admin. Access Token URL:  `https://oauth2.googleapis.com/token`.
12. You will be redirected and then granted access to your Aisera tenant platform.&#x20;
13. Edit the URLs from the Google Drive page to point to your tenant system: `<aisera_url>/?id=aisera.oauth.oauthCommand` where `<aisera_url>` is the endpoint you are using to access your instance of the Aisera platform.

### Set up a File Data - Data Source with Google Drive integration to Crawl Documents <a href="#pdf-page-rj60qusnctzfafoo3syg-pdf-page-llqad54idfkftq1hzmgr-id-2.-set-up-file-data-data-source-with" id="pdf-page-rj60qusnctzfafoo3syg-pdf-page-llqad54idfkftq1hzmgr-id-2.-set-up-file-data-data-source-with"></a>

After creating the integration, create the **File Data** data source that will crawl the documents from your Google Drive.

1. Click **Settings > Data Sources > New Data Source.**
2. Search for **File Data**, select the icon, and click **Next**.

<div align="left"><figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FlSC5azcEkLrrJRWtNbNB%2Ffile_data_source.png?alt=media&#x26;token=2b271420-b498-4b91-967c-eb96c78a0a62" alt="" width="563"><figcaption><p>File Data as Data Source</p></figcaption></figure></div>

3. Search for **File Data**, select the icon, and click **Next**.

<div align="left"><figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2F4zzk9ByRCjJS6BJRJoRh%2Ffile_data2.png?alt=media&#x26;token=4837cfed-0c07-452e-9baf-e398f9933958" alt="" width="563"><figcaption></figcaption></figure></div>

4. Enter the **Configuration** details:
   1. **Name:** Enter the Name of the Data Source
   2. **Data Type:** Select the Data Type to be Ingested, such as KnowledgeBase.
   3. **File:** Select **Cloud Files.**
   4. **Integration:** Select the name of the Integration you created above.\
      After you choose your integration, you may be asked for additional parameters, such as **Folder Path**, **Google Drive Id**, and [**File Search API Custom Query**](#google-drive-supports-custom-api-queries). This last options allows you to use labels to limit or include articles in the ingestion.&#x20;

<div align="left"><figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FCTtTVWIqjSgQ2Gv9BYrJ%2Fcustom_query2.png?alt=media&#x26;token=bb9479cb-7cac-4b0c-9b5e-4fcff500279a" alt="" width="375"><figcaption><p>Additional Parameters</p></figcaption></figure></div>

&#x20;e. **Folder Path:** Mention the folder path to your files/documents on Google Drive.\
\
(The other options are not needed for the Google Drive Data Source)

9. Click the **Next** button.
10. Optional - Choose a Template.&#x20;
11. Click **Next**.
12. If needed, modify the Ingestion Configuration
13. Click **OK**.
14. Browse to the Data Source page you just created and start the knowledge ingestion.

### Review Crawled Knowledge Documents

After the Data Source job run is completed, the administrator may review all the knowledge documents and ingested sections.

**To view all ingested documents:**

1. Navigate to **AI Workbench** on the left navigation panel.
2. Click the **Review > Knowledge Review** tab at the top of the page.

<figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FpcGmLAGPDK0c2hxyM5HE%2Fknowledge_reviews.png?alt=media&#x26;token=ab00dac7-4672-41eb-aced-802c77d38635" alt=""><figcaption><p>Knoeledge Review</p></figcaption></figure>

1. You will see **Commit Reviewed** and the number of documents that are ingested.
2. Since this is the first crawl, all the documents are **Reviewed** by default (Refer to the Knowledge Management document for more details)
3. Click on **Commit Reviewed** and click **Commit**.

<figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FGEBvvP1kjD0ipuRmXzlS%2Fcommit_knowledge.png?alt=media&#x26;token=b6ded2a3-7e67-4147-a82e-ba947e1b4598" alt="" width="563"><figcaption><p>Commit Knowledge Articles</p></figcaption></figure>

4. Navigate to the **SOR > Knowledge** tab in the left panel and you will see all the ingested documents.&#x20;

&#x20;    (It might take a couple of minutes to show/load the docs in the \
&#x20;     **Knowledge** tab)

<figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FIw17nTDV71SRsk4yQ1SF%2Fknow_docs.png?alt=media&#x26;token=b9d2d750-00d7-464c-b0e6-471443a02262" alt=""><figcaption><p>System of Record (SOR) Knowlege Documents</p></figcaption></figure>

### Google Drive Supports Custom API Queries

In the Data Source Configuration for a Google Drive integration, there is a parameter called, **File Search API Custom Query** that is used to limit KB Article ingestion based on labels.

<div align="left"><figure><img src="https://3281977978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvBFXjH9S1CAy9f5hzg5Q%2Fuploads%2FdUhFvEnEqjQTLsFpBKKa%2F8.png?alt=media&#x26;token=0b70c535-be6e-4aca-aee2-8c8ee4c6cccc" alt="" width="563"><figcaption><p>File Search API</p></figcaption></figure></div>

The **File Search API Custom Query** field accepts a comma-separated list of label IDs to flag articles that are meant to be excluded; documents that contain them will not be ingested.\
\
This field also accepts a [**Google Drive Rest API**](https://developers.google.com/drive/api/reference/rest/v3/files) compatible query.

You can also use the **File Search API Custom Query** field to include labels (make sure that ingested documents must contain some specific labels), filter on other metadata like the Document’s **Author** field.
