Gmail Integration

Estimated reading: 8 minutes

The Google Gmail integration enables Robility to securely connect with Google Gmail services through the Gmail API. You can use this integration to automate email operations within your workflows.

Building an automation workflow with Google Gmail requires configuring a connection in the App Integrations menu in Robility Manager. Robility supports OAuth 2.0 authentication for establishing secure connections between your Robility environment and a Google Workspace Gmail account.

Important: Gmail integration supports only OAuth 2.0 authentication. For Google Workspace accounts, an administrator may need to approve the Robility application before users can authorize and use Gmail connections.

Prerequisites

Before configuring the Google Gmail integration in Robility, ensure you have:

a. Access to a valid Google Workspace Gmail account.
b. Access to Robility Manager > App Integrations.
c. Google Cloud Console access to generate a Client ID and Client Secret.
d. Google Workspace Administrator privileges
e. The required Gmail API OAuth scopes enabled for your connection.

Supported Authentication Types

When setting up a Google Gmail connection in Robility Manager > App Integrations, select the required authentication strategy from the Change Authentication Type dropdown.

Robility supports the following OAuth 2.0 authentication methods:

1. OAuth 2.0 Authorization Code

Enables you to sign in directly using your Google Workspace Gmail account to authenticate with Robility’s predefined OAuth application and scopes.

Execution Behavior: During the initial setup, Robility opens a Google sign-in browser window. The user signs in to their Gmail account, completes any configured Multi-Factor Authentication (MFA), and approves the requested permissions. Robility receives the authorization code, exchanges it for access and refresh tokens, and establishes the connection. Robility’s App Integration service automatically refreshes the access token in the during workflow execution.

Recommended for: Standard integrations where users authenticate directly with their Gmail credentials without managing custom Google Cloud OAuth applications.

2. OAuth 2.0 Custom OAuth Application

Enables you to manually provide your own Client ID, Client Secret, and OAuth scopes using a custom OAuth 2.0 application created in Google Cloud Console.

Parameter Description
Client ID The public ID you get when creating OAuth 2.0 credentials in Google Cloud Console so Google knows which app is connecting.
Client Secret The private key paired with your Client ID in Google Cloud Console to verify the connection securely—keep this confidential.
Scopes The specific Gmail permissions (such as reading or sending email) your integration is asking permission to use.

Recommended for: Enterprise setups that need to use company-owned Google Cloud OAuth credentials and tightly control which Gmail permissions are granted.

Token & Session Behavior

Authentication Type Initial User Interaction Token / Session Behavior Recommended Use
OAuth 2.0 Authorization Code Yes (Google Sign-In) Google sign-in sessions last about 1 hour at a time, and Robility renews them in the background automatically—as long as access isn't revoked or left unused for 6 months. Fast setup using Robility's built-in Google sign-in app.
OAuth 2.0 Custom OAuth Application Yes (Initial Consent) Uses your own Google Cloud Client ID and Client Secret and follows Google's standard sign-in refresh rules (about 1 hour per session, with automatic renewal based on your Google token settings). Company-wide setups where your IT team manages its own Google Cloud credentials.

Token Storage & Renewal Mechanics

Token Management and Security

After a Gmail connection is successfully authorized, Robility securely stores the authentication tokens required to access Gmail services. All stored tokens are encrypted and associated with the specific integration connection.

Token Expiration and Automatic Renewal

Robility continuously tracks the validity of the access token and verifies its status before executing Gmail operations through the Gmail Scope activity. To ensure uninterrupted execution, the platform automatically renews access tokens before they expire.

Automatic Token Refresh

When an access token expires, Robility automatically obtains a new access token using the stored refresh token without requiring user intervention. The renewed token information is updated automatically, allowing workflow execution to continue seamlessly.

Note: The existing refresh token is retained and reused unless Google issues a replacement refresh token during the authorization process.

Connection Status and Reauthentication

The App Integrations page displays the current status of each configured Gmail connection:

a. Connected: The Gmail connection is active and available for use in workflows.
b. Expired: The connection is no longer valid and requires reauthentication.
c. Error: The connection could not be established due to invalid configuration, insufficient permissions, or Google Workspace policy restrictions. Error details are displayed to help identify and resolve the issue.

When Reauthentication Is Required

You may need to reconnect your Gmail account in the following situations:

1. Access to Robility has been revoked from your Google Account security settings.
2. The Gmail connection has remained unused for an extended period.
3. Your Google account password has been changed, causing existing authentication tokens to become invalid.
4. The maximum number of active Google authentication tokens for the account has been exceeded.
5. The Google Cloud OAuth consent configuration remains in Testing mode, causing authentication tokens to expire after a limited period.

Note: If the connection status changes to Expired or Error, reauthenticate the Gmail connection from the App Integrations page before executing Gmail activities.

Configuring the Google Gmail Integration

Configure OAuth 2.0 Authorization Code

1. Navigate to Robility Manager > App Integrations.
2. Select Google Gmail.
3. Select OAuth 2.0 Authorization Code from the authentication dropdown.
4. Click Connect.
5. In the Google Sign-In browser window, enter your Google Workspace Gmail account credentials and complete any required Multi-Factor Authentication (MFA) or 2-Step Verification.
6. Review the requested permissions on the Google consent screen and click Allow.
7. Once connected, Robility securely stores the OAuth tokens and displays the connection status as Connected, making the integration available for workflow execution.

Configure OAuth 2.0 Custom OAuth Application

1. Create an OAuth 2.0 Client ID in Google Cloud Console, enable the Gmail API, and copy the Client ID and Client Secret.
2. Navigate to Robility Manager > App Integrations.
3. Select Google Gmail.
4. Select OAuth 2.0 Custom OAuth Application.
5. Enter the Client ID, Client Secret, and required OAuth scopes.
6. Click Connect and complete the Google authorization process.
7. Once connected, Robility securely stores the credentials and OAuth tokens, updates the connection status to Connected, and makes the connection available for use across Gmail activities within workflows.

Security Considerations

1. Use Modern Authentication: Prefer OAuth 2.0 over legacy password-based email authentication.
2. Encrypted Credential and Token Storage: Client IDs, Client Secrets, access tokens, and refresh tokens are encrypted at rest and bound strictly to authorized connections.
3. Frontend Response Sanitization: Raw access tokens, refresh tokens, and Client Secret values are strictly isolated to the backend token management service and are never exposed through UI responses, browser payloads, or client-side APIs.
4. Redacted Application and Workflow Logs: Authentication events and error codes are logged for troubleshooting, while bearer tokens, authorization codes, client secrets, token strings, and sensitive email data are automatically redacted from logs.
5. Least Privilege Scopes: Request only the minimum Gmail OAuth scopes required for your use case (gmail.readonly, gmail.send, or gmail.modify).
6. Production Consent Screen: Publish custom Google Cloud OAuth consent screens to In Production to avoid 7-day refresh token expiration.
7. Regular Audits: Periodically review authorized third-party applications in Google Account Security settings and the Google Workspace Admin Console.

Troubleshooting

1. Connection Expires Every 7 Days

Cause: Your custom Google Cloud OAuth application’s consent screen is still in Testing mode, causing Google to expire refresh tokens after 7 days (invalid_grant).
Resolution: In Google Cloud Console > APIs & Services > OAuth Consent Screen, change the publishing status to In Production, then reauthenticate the connection in Robility.

2. Connection Stops Working After 6 Months or Following Security Changes

Cause: Google may invalidate refresh tokens when:

i. A refresh token remains unused for 6 consecutive months.
ii. Google invalidates tokens following account security changes.
iii. The refresh token limit per user and OAuth client is exceeded.

Robility updates the connection status to Expired and requires reauthentication.

Resolution: Navigate to Robility Manager > App Integrations, select the affected Gmail connection, and complete the reauthentication process.

3. “Access blocked: Admin policy enforces app access control” (Error 400: admin_policy_enforced)

Cause: Google Workspace administrator policies restrict unapproved third-party applications from accessing Gmail.
Resolution: Have your Google Workspace Administrator navigate to: Admin Console > Security > Access and Data Control > API Controls > Manage Third-Party App Access

Then mark the Robility OAuth Client ID as Trusted.

4. Gmail Activity Fails Outside Scope

Cause: Activities such as GetMailDetails, ReadMail, or SendMail are placed directly in the workflow sequence without being contained within a Gmail Scope Activity.
Resolution: Place all Gmail activities inside a configured Gmail Scope Activity that references a valid Gmail connection.

Best Practices

a. Use OAuth 2.0 Authorization Code for quick user-authenticated setups.
b. Use OAuth 2.0 Custom OAuth Application when organization-managed Google Cloud OAuth applications are required.
c. Apply least-privilege scopes (gmail.readonly for read-only scenarios, gmail.send for send-only scenarios, or gmail.modify when both read and write operations are required).
d. Always place Gmail activities inside a Gmail Scope Activity.
e. Ensure the Gmail connection is used periodically (at least once every 6 months) to prevent refresh token expiration due to inactivity.
f. Publish custom OAuth consent screens to In Production before deployment.
g. Pre-approve the OAuth Client ID in Google Workspace Admin Console for enterprise deployments.

Share this Doc

Gmail Integration

Or copy link

CONTENTS
Robility Chatbot
Robility Assistant
Online