Connecting Gmail
editConnecting Gmail
editGmail is Google’s popular, fast, and secure cloud-based email service. The Gmail connector is a remote connector. This means that Workplace Search will query Google’s servers on your behalf. The results are measured against all of your other stored and remote documents, then surfaced as part of the most relevant set of results.
Remote sources like Gmail are private sources. Once you have configured the connector, each individual member must add it as a unique private source via their personal settings. Each member may connect only one Gmail private content source.
The Gmail connector searches the following data from Gmail:
Gmail Documents |
Including ID, File Metadata, Excerpt, Sender, Recipient and timestamps |
Configuring the Gmail Connector
editConfiguring the Gmail connector is the first step prior to connecting the Gmail service to Workplace Search, and requires that you create an OAuth App from the Gmail platform.
Step 1. To get started, log in to the Google Developer Console.
Make sure that you create this project with a trusted and stable Google account. We recommend using a team-owned account.
Step 2. We must first create a project, and then add access to the Gmail API to it. Click Create when prompted:
![](images/guides/gmail/gmail-create-project.png)
If you already have active projects, you can create a new project from the Project Dropdown menu:
![](images/guides/gmail/gmail-create-project-existing.png)
Fill in the project information in a way that best suits your organization.
Step 3. Using the search bar located at the top of the console, navigate to the Gmail API:
![](images/guides/gmail/gmail-search-for-api.png)
Step 4. Enable access to the Gmail API for this project:
![](images/guides/gmail/gmail-enable.png)
Step 5. You will be prompted to Create Credentials:
![](images/guides/gmail/gmail-create-credentials.png)
Step 6. Select Gmail API as the API you are using. You will call it from Web browser to access User data:
![](images/guides/gmail/gmail-create-api.png)
Step 7. Click What credentials do I need?, and select the Set up consent screen option:
![](images/guides/gmail/gmail-set-up-consent-screen.png)
Step 8. Select Internal as User Type.
Step 9. Fill out the information in the OAuth Consent Screen form.
![](images/guides/gmail/gmail-consent-screen-form.png)
Step 10. In the Scopes for Google APIs section, we must add one value:
../auth/gmail.readonly
![](images/guides/gmail/gmail-add-scope.png)
Save the changes.
Step 11. We must now create credentials for the OAuth application. Locate the Credentials menu item in the left sidebar, click Create Credentials and select OAuth Client ID.
![](images/guides/gmail/gmail-create-oauth-id.png)
Step 12. Fill out the OAuth form:
- Application type: Web application.
- Name: Whichever feels best for you. Workplace Search makes sense, keeps things clear.
-
Authorized JavaScript origins: The base URL at which Workplace Search is hosted (scheme + host, no path).
Examples:
# Deployment using a custom domain name https://www.example.com # Deployment using a default Elastic Cloud domain name https://c3397e558e404195a982cb68e84fbb42.ent-search.us-east-1.aws.found.io # Unsecured local development environment http://localhost:3002
-
Authorized redirect URIs: The following two URLs, substituting
<WS_BASE_URL>
with the base URL at which Workplace Search is hosted (scheme + host, no path).<WS_BASE_URL>/ws/org/sources/gmail/create <WS_BASE_URL>/ws/sources/gmail/create
Examples:
# Deployment using a custom domain name https://www.example.com/ws/org/sources/gmail/create https://www.example.com/ws/sources/gmail/create # Deployment using a default Elastic Cloud domain name https://c3397e558e404195a982cb68e84fbb42.ent-search.us-east-1.aws.found.io/ws/org/sources/gmail/create https://c3397e558e404195a982cb68e84fbb42.ent-search.us-east-1.aws.found.io/ws/sources/gmail/create # Unsecured local development environment http://localhost:3002/ws/org/sources/gmail/create http://localhost:3002/ws/sources/gmail/create
![](images/guides/gmail/gmail-create-oauth-id-form.png)
Step 13. Upon submission, you will be presented with a Client ID and Client Secret.
Keep them handy, as we’ll need them in a moment.
Step 14. From the Workplace Search administrative dashboard’s Sources area, locate Gmail, click Configure and provide both the Client ID and Client Secret.
Voilà! The Gmail connector is now configured, and ready to be used to synchronize content.
Reminder: Gmail must be added as a private content source.
Each individual will need to add it!
Connecting Gmail to Workplace Search
editOnce the Gmail connector has been configured, you may connect a Gmail instance to your private search experience.
Step 1. Access your own Workplace Search search dashboard, and click the Manage button.
![](images/guides/gmail/gmail-manage-private-sources.png)
Step 2. Click Connect Source.
![](images/guides/gmail/gmail-connect-1.png)
Step 3. Click Connect. You will see Google’s OAuth screen.
Accept the permissions to connect your Google account.
![](images/guides/gmail/gmail-connect-2.png)
Step 4. Success! Your personal Gmail is now available to your search experience.
![](images/guides/gmail/gmail-private-success.png)
Gmail does not need to synchronize.
You will have the freshest content available each time you query.