Connecting Gmailedit

Gmail 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 Connectoredit

Configuring 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:

Figure 38. Connecting Gmail

If you already have active projects, you can create a new project from the Project Dropdown menu:

Figure 39. Connecting Gmail

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:

Figure 40. Connecting Gmail

Step 4. Enable access to the Gmail API for this project:

Figure 41. Connecting Gmail

Step 5. You will be prompted to Create Credentials:

Figure 42. Connecting Gmail

Step 6. Select Gmail API as the API you are using. You will call it from Web browser to access User data:

Figure 43. Connecting Gmail

Step 7. Click What credentials do I need?, and select the Set up consent screen option:

Figure 44. Connecting Gmail

Step 8. Select Internal as User Type.


Step 9. Fill out the information in the OAuth Consent Screen form.

Figure 45. Connecting Gmail

Step 10. In the Scopes for Google APIs section, we must add one value:

../auth/gmail.readonly
Figure 46. Connecting Gmail

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.

Figure 47. Connecting Gmail

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
Figure 48. Connecting Gmail

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 Searchedit

Once 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.

Figure 49. Connecting Gmail

Step 2. Click Connect Source.

Figure 50. Connecting Gmail

Step 3. Click Connect. You will see Google’s OAuth screen.

Accept the permissions to connect your Google account.

Figure 51. Connecting Gmail

Step 4. Success! Your personal Gmail is now available to your search experience.

Figure 52. Connecting Gmail

Gmail does not need to synchronize.

You will have the freshest content available each time you query.