Gmail is an email service provided by Google.
Torq enables quick and easy integration with Gmail, so you can automate anything and everything within moments. Torq's public Gmail steps include:
Add Labels to Message
Create Label
Generate Gmail Token
Get Attachment
+15 more...
If you don't see a step you need, you can create your own in various ways, such as using the Send an HTTP Request step or Torq’s Step Builder, and share it across your organization.
Use Gmail to Trigger Workflows in Torq
Step One: Create a Gmail Trigger Integration in Torq
Add the Integration: Navigate to Build > Integrations > Triggers > Gmail and click Add Instance.
Configure the Integration:
Enter a unique and meaningful name.
Finalize: Click Add and Copy the generated endpoint. You will need the URL for the subscription in GCP.
Step Two: Create a Project in GCP
Open the Google Cloud Console: Navigate to IAM & Admin > Create a Project.
Create a New Project:
Enter a meaningful name for the project.
Select an organization.
Select the location.
Finalize: Click Create.
Step Three: Create a Service Account in the Project
Create a Service Account: Navigate to IAM & Admin > Service Accounts and click Create service account.
Configure the Service Account:
Enter a meaningful name.
Enter a unique ID.
(Optional) Provide a description.
Click Create and continue.
(Optional) Grant the service account access to a project.
(Optional) Grant users or groups access to the service account.
Finalize: Click Done.
Step Four: Create a Pub/Sub Topic
Open the Pub/Sub page: Navigate to Solutions > All products and click Pub/Sub. This will enable the Cloud Pub/Sub API.
Create a Topic: Go to Pub/Sub > Topics and click CREATE TOPIC.
Configure the Topic:
Enter a meaningful name.
Disable Add a default subscription. You will create a customized subscription later.
Finalize: Click CREATE.
Step Five: Create a Pub/Sub Subscription
Create a Subscription: Go to the topic's SUBSCRIPTIONS tab and click CREATE SUBSCRIPTION.
Configure the Subscription:
Enter a meaningful Subscription ID.
Select Push for the delivery type.
Paste the Torq endpoint URL you copied earlier.
Finalize: Click CREATE.
Step Six: Grant Permissions to the Topic
Add a Principal: Go to the topic's PERMISSIONS tab and click ADD PRINCIPAL.
Configure the Principal:
Enter
gmail-api-push@system.gserviceaccount.com
for the principal.Assign the Pub/Sub Publisher role.
Finalize: Click SAVE.
Now that you've successfully created a Gmail trigger, you can build your first Gmail-initiated workflow!
In Torq, go to Build > Workflows > Create a Workflow > New Blank Workflow, and select the trigger type: Integrations > Gmail. Find your new trigger, and automate away!
Use Gmail Steps in Torq
Gmail steps in Torq workflows require the GCP steps integration.
If you've already created a relevant project and service account in GCP, you can skip to step three below.
Step One: Create a Project in GCP
Open the Google Cloud Console: Navigate to IAM & Admin > Create a Project.
Create a New Project:
Enter a meaningful name for the project.
Select an organization.
Select the location.
Finalize: Click Create.
Step Two: Create a Service Account in the Project
Create a Service Account: Navigate to IAM & Admin > Service Accounts and click Create service account.
Configure the Service Account:
Enter a meaningful name.
Enter a unique ID.
(Optional) Provide a description.
Click Create and continue.
(Optional) Grant the service account access to a project.
(Optional) Grant users or groups access to the service account.
Finalize: Click Done.
Step Three: Add a Private Key to the Service Account
Go to the Service Account's Keys: Locate the service account, and in the Actions column click Actions > Manage keys.
Create a Key: Click Add key > Create new key, select JSON, and then click Create.
Finalize: Save the private key for later—you will use it when creating the GCP integration in Torq.
Step Four: Authorize the Service Account
For Torq to access your Google users' data (impersonation), you need to authorize the service account in your GCP admin console.
Go to the Service Account's Details: Select the Details tab.
Copy the Client ID: Open Advanced settings and under Domain-wide Delegation copy the client ID. You will need it when delegating domain-wide authority to the service account.
Open the Google Admin Console: Click View Google Workspace Admin Console.
Go to API Controls: Navigate to Security > Access and Data control > API controls.
Enable Domain-Wide Delegation: In the Domain wide delegation section, click MANAGE DOMAIN WIDE DELEGATION and then Add new.
Define Permissions:
Paste the Client ID that you copied earlier.
Enter a comma-separated list of scopes you want to use in Torq. See the complete list of OAuth 2.0 scopes for Google APIs.
Finalize: Click AUTHORIZE.
Step Five: Enable the Gmail API
Open the Google Cloud Console: Navigate to APIs & Services > Library.
Enable the Gmail API: Select Gmail API and click ENABLE.
Step Six: Create a GCP Steps Integration in Torq
Navigate to the Integration: Go to Build > Integrations > Steps > Google Cloud Platform (GCP) and click Add Instance.
Configure the Integration:
Enter a meaningful name for the integration.
Upload the private key you generated earlier.
Finalize: Click Add.
Templates
Now that you've added your integrations, check out these specially crafted templates by Torq's security experts. Visit Torq's template library for more.