> ## Documentation Index
> Fetch the complete documentation index at: https://ampersand-24eb5c1a-cobalt0s-google-contacts.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Google

The Google connector supports Google products which have APIs with the root URL `googleapis.com`, these include:

* Calendar
* Gmail
* Contacts
* Google Drive

## What's supported

### Supported actions

This connector supports:

* [Proxy Actions](/proxy-actions), using the base URL `https://www.googleapis.com`.

The **Calendar** module supports:

* [Read Actions](/read-actions), including historical backfill. Please note that incremental
  read **is only supported for the Calendar `Events` object**; otherwise, a full read of the Google instance will be performed for each scheduled run.
* [Write Actions](/write-actions).

> **Important Note on Events Backfill**: The `events` object has a 28-day cap for historic backfill and does not support full history, due to limitations in the Google API. When syncing events data, ensure your backfill period does not exceed 28 days.

The **Gmail** module supports:

* [Read Actions](/read-actions), including historical backfill. Please note that incremental read and pagination
  **are only supported for `Drafts`, `Messages`, and `Threads` objects**; otherwise, a full read of the Gmail instance will be performed for each scheduled run.
* [Write Actions](/write-actions).

The **Contacts** module supports:

* [Read Actions](/read-actions), including historical backfill. Please note that incremental read is not supported, a full read of the Google Contacts will be done for each scheduled read.
* [Write Actions](/write-actions).

### Supported Calendar objects

The Google connector supports reading from and writing to the following **Calendar** module objects:

* [acl](https://developers.google.com/workspace/calendar/api/v3/reference/acl)
* [calendarList](https://developers.google.com/calendar/api/v3/reference/calendarList#resource-representations)
* [events](https://developers.google.com/workspace/calendar/api/v3/reference/events)

The Google connector supports the following read-only objects:

* [settings](https://developers.google.com/workspace/calendar/api/v3/reference/settings)

### Supported Gmail objects

The Google connector supports reading from and writing to the following **Gmail** module objects:

* [delegates](https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.settings.delegates/list)
* [drafts](https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.drafts/list)
* [filters](https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.settings.filters/list)
* [forwardingAddresses](https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.settings.forwardingAddresses/list)
* [identities](https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.settings.cse.identities/list)
* [keypairs](https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.settings.cse.keypairs/list)
* [labels](https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.labels/list)
* [sendAs](https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.settings.sendAs/list)

The Google connector supports the following read-only objects:

* [messages](https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.messages#Message)
* [threads](https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.threads/list)

### Supported Contacts objects

The Google connector supports reading from and writing to the following **Contacts** module objects:

* [contactGroups](https://developers.google.com/people/api/rest/v1/contactGroups)
* [myConnections](https://developers.google.com/people/api/rest/v1/people.connections)
* [peopleDirectory](https://developers.google.com/people/api/rest/v1/people)

The Google connector supports the following read-only objects:

* [otherContacts](https://developers.google.com/people/api/rest/v1/otherContacts)

### Example integration

Example manifest files can be found in our samples repository on GitHub:

* [Google Calendar example](https://github.com/amp-labs/samples/blob/main/google-calendar/amp.yaml)
* [Gmail example](https://github.com/amp-labs/samples/blob/main/google-gmail/amp.yaml)
* [Google Contacts example](https://github.com/amp-labs/samples/blob/main/google-contacts/amp.yaml)

## Before you get started

To integrate Google with Ampersand, you will need a [Google Cloud account](https://cloud.google.com/).

Once your account is created, you'll need to create a Google app, configure the Ampersand redirect URI within the app, and obtain the following credentials from your app:

* Client ID
* Client Secret
* Scopes

You will then use these credentials to connect your application to Ampersand.

### Create a Google Cloud account

You can sign up for a [free Google Cloud account here](https://cloud.google.com/free).

### Enable the appropriate APIs

Go to the [API Library page](https://console.cloud.google.com/apis/library) of Google Cloud Console and search for the APIs your integration will need. For example, if you are building a Google Drive integration, type "Google Drive", select the right API and click the "Enable" button.

<img src="https://mintcdn.com/ampersand-24eb5c1a-cobalt0s-google-contacts/JnltqwAZBdLtN-0w/images/provider-guides/2a15717-Screenshot_2024-07-19_at_10.47.22_AM.png?fit=max&auto=format&n=JnltqwAZBdLtN-0w&q=85&s=dc22435fca428072bc5b59f2fc48471f" alt="API Library" width="2167" height="1266" data-path="images/provider-guides/2a15717-Screenshot_2024-07-19_at_10.47.22_AM.png" />

Repeat this process for all the APIs your integration will need.

### Creating a Google App

Follow the steps below to create a Google App:

1. Go to the [OAuth consent screen](https://console.cloud.google.com/apis/credentials/consent) page, pick "External" as the User Type.

<img src="https://mintcdn.com/ampersand-24eb5c1a-cobalt0s-google-contacts/JnltqwAZBdLtN-0w/images/provider-guides/1537ae6-Screenshot_2024-07-19_at_10.40.32_AM.png?fit=max&auto=format&n=JnltqwAZBdLtN-0w&q=85&s=1d89b8bb5935469f4f2e16e2b751cd89" alt="OAuth Consent" width="1866" height="1148" data-path="images/provider-guides/1537ae6-Screenshot_2024-07-19_at_10.40.32_AM.png" />

<br />

2. Enter the information required on the next page, click "Save and Continue".

**Important information about App Logo**: when you are creating a Google app for development purposes, do not upload a logo. Uploading a logo will trigger an app verification process. When you are ready to submit your app for review by Google, then you can come back to this page and upload a logo.

<img src="https://mintcdn.com/ampersand-24eb5c1a-cobalt0s-google-contacts/JnltqwAZBdLtN-0w/images/provider-guides/5600533-Screenshot_2024-07-19_at_10.56.54_AM.png?fit=max&auto=format&n=JnltqwAZBdLtN-0w&q=85&s=7c6184d6b1e90870f4aaf4120aceaf35" alt="App Logo" width="1870" height="1430" data-path="images/provider-guides/5600533-Screenshot_2024-07-19_at_10.56.54_AM.png" />

3. On the Scopes page, click "Add or Remove Scopes", and then select the scopes that your integration will need. For example, if you are integrating with Google Drive, type "Google Drive" into the search box and select the scopes you will need. If the scopes you require are not popping up, ensure that you've enabled the appropriate APIs (previous step), and then refresh the page.

<img src="https://mintcdn.com/ampersand-24eb5c1a-cobalt0s-google-contacts/zeOBE9NvXIiRotbQ/images/provider-guides/d542878-Screenshot_2024-07-19_at_1.45.02_PM.png?fit=max&auto=format&n=zeOBE9NvXIiRotbQ&q=85&s=4f5373fd387d29411ac73483503ad621" alt="Scopes" width="1490" height="1178" data-path="images/provider-guides/d542878-Screenshot_2024-07-19_at_1.45.02_PM.png" />

4. On the Test Users page, click "+ Add Users" to add up to 100 email addresses, and then click "Save and Continue".

<img src="https://mintcdn.com/ampersand-24eb5c1a-cobalt0s-google-contacts/zeOBE9NvXIiRotbQ/images/provider-guides/b3953c3-Screenshot_2024-07-19_at_1.46.54_PM.png?fit=max&auto=format&n=zeOBE9NvXIiRotbQ&q=85&s=8139248afa3b86689fa9b86deec350fd" alt="Add Users" width="1798" height="674" data-path="images/provider-guides/b3953c3-Screenshot_2024-07-19_at_1.46.54_PM.png" />

### Creating Client ID and Client Secret

1. Once your Google App has been created, go to the [Credentials page](https://console.cloud.google.com/apis/credentials) of Google Cloud Console. Click on "Create Credentials" and then select "OAuth Client ID".

<img src="https://mintcdn.com/ampersand-24eb5c1a-cobalt0s-google-contacts/JnltqwAZBdLtN-0w/images/provider-guides/2a3a0ed-Screenshot_2024-07-19_at_11.07.26_AM.png?fit=max&auto=format&n=JnltqwAZBdLtN-0w&q=85&s=c65446004d607621324311c29161b172" alt="Create Credentials" width="2088" height="932" data-path="images/provider-guides/2a3a0ed-Screenshot_2024-07-19_at_11.07.26_AM.png" />

2. Click "Web Application" from the Application Type dropdown menu.

<img src="https://mintcdn.com/ampersand-24eb5c1a-cobalt0s-google-contacts/JnltqwAZBdLtN-0w/images/provider-guides/4071e04-Screenshot_2024-07-19_at_11.08.21_AM.png?fit=max&auto=format&n=JnltqwAZBdLtN-0w&q=85&s=3f6a6d6f7fa1fe9de1557269d9396fb3" alt="Web Application" width="1786" height="982" data-path="images/provider-guides/4071e04-Screenshot_2024-07-19_at_11.08.21_AM.png" />

3. In the name box, write down a descriptive name like "Ampersand Integration". Under "Authorized redirect URIs", add `https://api.withampersand.com/callbacks/v1/oauth`. Click "Create".

<img src="https://mintcdn.com/ampersand-24eb5c1a-cobalt0s-google-contacts/zeOBE9NvXIiRotbQ/images/provider-guides/897fe36-fixed.png?fit=max&auto=format&n=zeOBE9NvXIiRotbQ&q=85&s=12aa1a7c34049a13a08a87ea6e4b996f" alt="Authorized Redirect URIs" width="1744" height="1878" data-path="images/provider-guides/897fe36-fixed.png" />

4. There will be a popup which displays the Client ID and Client Secret, you'll need to add these to the Ampersand Dashboard in the next step. You can either copy and paste these values, or click "Download JSON".

<img src="https://mintcdn.com/ampersand-24eb5c1a-cobalt0s-google-contacts/zeOBE9NvXIiRotbQ/images/provider-guides/d0de0fe-GoogleOAuthClient.png?fit=max&auto=format&n=zeOBE9NvXIiRotbQ&q=85&s=b70353c0a9f9f3988118c9a1b087b820" alt="Client ID and Client Secret" width="527" height="562" data-path="images/provider-guides/d0de0fe-GoogleOAuthClient.png" />

## Add Your Google App info to Ampersand

1. Log in to your [Ampersand Dashboard](https://dashboard.withampersand.com).

2. Select the project where you want to create a Google integration.

   <img src="https://mintcdn.com/ampersand-24eb5c1a-cobalt0s-google-contacts/zeOBE9NvXIiRotbQ/images/provider-guides/dd47b7a-Ampersand.png?fit=max&auto=format&n=zeOBE9NvXIiRotbQ&q=85&s=ccf7bd4d22e72002a3450c628fd9dc42" alt="Ampersand Project" width="2244" height="442" data-path="images/provider-guides/dd47b7a-Ampersand.png" />

3. Select **Provider apps**.

4. Select *Google* from the **Provider** list.

5. Enter the previously obtained *Client ID* in the **Client ID** field and the *Client Secret* in the **Client Secret** field. In the **Scopes** field, enter each of your scopes on a separate line, and prefix each scope with `https://www.googleapis.com/auth`.

<img src="https://mintcdn.com/ampersand-24eb5c1a-cobalt0s-google-contacts/zeOBE9NvXIiRotbQ/images/provider-guides/6b33461-Screenshot_2024-07-19_at_1.10.08_PM.png?fit=max&auto=format&n=zeOBE9NvXIiRotbQ&q=85&s=89ab804702a142d93eab0808eee73aa1" alt="Scopes" width="1168" height="1206" data-path="images/provider-guides/6b33461-Screenshot_2024-07-19_at_1.10.08_PM.png" />

6. Click **Save changes**.

## Ship your integration to production

When you are ready to use your integration with external customers, you'll need to go through the Google App verification process.

1. Go back to the [OAuth consent screen](https://console.cloud.google.com/apis/credentials/consent) page, click on "Edit App" to upload a logo and fill out all the form fields (such as Privacy Page, Terms of Service).
2. After saving your changes, click on the "Publish App" button under "Publishing Status".

<img src="https://mintcdn.com/ampersand-24eb5c1a-cobalt0s-google-contacts/zeOBE9NvXIiRotbQ/images/provider-guides/ee95f57-Screenshot_2024-07-19_at_11.42.12_AM.png?fit=max&auto=format&n=zeOBE9NvXIiRotbQ&q=85&s=7cb977bcfabfa84be54bd6b0706ed5b0" alt="Publish App" width="1608" height="918" data-path="images/provider-guides/ee95f57-Screenshot_2024-07-19_at_11.42.12_AM.png" />

3. Then click on the "Prepare for Verification" button that should now be visible, follow the instructions on the screen.

<img src="https://mintcdn.com/ampersand-24eb5c1a-cobalt0s-google-contacts/zeOBE9NvXIiRotbQ/images/provider-guides/7fb1236-Screenshot_2024-07-19_at_11.46.20_AM.png?fit=max&auto=format&n=zeOBE9NvXIiRotbQ&q=85&s=7732dd52bdef515c21e2f1f044e140ee" alt="Prepare for Verification" width="1736" height="706" data-path="images/provider-guides/7fb1236-Screenshot_2024-07-19_at_11.46.20_AM.png" />

For more information about the Google verification process, see [Google Support docs](https://support.google.com/cloud/answer/13463073?sjid=12970809243513943038-NC)
