This article describes the steps for setting up an Email Service Account in Gmail. Click the steps below to learn more.
- Step 1: Set Up Your Google Cloud Platform (GCP) Organization
- Step 2: Create a Google Cloud Project for Demandbase
- Step 3: Enable API for Gmail and Calendar
- Step 4: Create a Service Account
- Step 5: Enable G-Suite Domain-wide Delegation
- Step 6: Grant permissions to the Service Account in G-Suite
- Step 7: Add the Service Account to Demandbase
Step 1: Set Up Your Google Cloud Platform (GCP) Organization
1.1 If you are a G-Suite or Cloud identity customer, an Organization resource is provided to you automatically.
1.2 The G-Suite or Cloud Identity super administrators are the first users who can access the organization upon creation.
Step 2: Create a Google Cloud Project for Demandbase
2.1 Go to the Manage Resources page in the Cloud Console.
2.2 Select Organization in the drop-down at the top of the page and select the organization you want to create a project for.
2.3 Click Create Project.
2.4 In the New Project window, enter a project name (Example: Demandbase Service Account) and select a billing account.
2.5 When you're finished entering the project details, click Create.
Step 3: Enable API for Gmail and Calendar
3.1 Go to the Google Cloud API Dashboard page. Make sure the project (Example: Demandbase Service Account) is selected in the drop-down at the top of the page.
3.2 Click Enable APIs and Services.
3.3 Search for Gmail and click the Gmail API from the search results.
3.4 Click Enable to enable the Gmail API for this project.
3.5 Click the back arrow next to the API Library.
3.6 Search for Calendar and click Google Calendar API from the search results.
3.7 Click Enable to enable the Google Calendar API for this project.
Step 4: Create a Service Account
4.1 Go to the Service Accounts page, Make sure the project (Example: Demandbase Service Account) is selected in the drop-down at the top of the page.
4.2 Click Create Service Account.
4.3 Enter the details for the Service Account.
- Service Account Name:
Example: Demandbase Service Account
- Service Account Description:
Example: Service account to sync emails and calendar with Demandbase.
- Click Create.
4.4 For service account permissions select Project > Viewer and click Continue.
4.5 Generate a key for the service account.
- Click Create Key.
- Select P12 for the key type and click Create.
- This will generate and download a key file. Please keep this; you will use the key in Step 7.
4.6 Click Done.
Step 5. Enable G-Suite Domain-wide Delegation
5.1 Go to the Service Accounts page. Make sure the project (Demandbase Service Account) is selected in the drop-down at the top of the page.
5.2 Click the service account created in step 4. (Demandbase Service Account).
5.3 Make note of the Unique ID. This will be used in Step 6.
5.4 Click Edit.
5.5 Click Show Domain-Wide Delegation.
5.6 Click the checkbox next to the Enable G-Suite Domain-Wide Delegation.
5.7 Click Save.
Step 6: Grant Permissions to the Service Account in G-Suite
6.1 Login to your G-Suite Admin Portal.
6.2 Click Security.
6.3 Click API Controls.
6.4 Click Manage Domain Wide Delegation.
6.5 Click Add New
6.6 Client Name: Unique ID from Step 5.3.
6.7 Add One or more API Scopes in OAuth Scopes (comma delimited):
6.8 Click Authorize.
Step 7: Add the Service Account to Demandbase
7.1 In Demandbase, click the cogwheel Settings icon in the left panel.
7.2 Under Platform, click Email Service Account.
7.3 Click Enable Service Account.
7.4 Enter Service Account Email.
7.5 Add the Key from Step 4.5.
7.6 Click Connect.