In this article I will explain the automatic process relating to Gmail.
Gmail is an email service provided by Google. As long as you have an environment that allows you to connect to the Internet, you can use it on any device such as a smartphone or a computer. You can also use the API to perform various operations, which is also used in the automated process introduced here.
- Available only with Gmail for business (used in Google Workspace).
- (Accounts with @gmail.com address are not eligible)
For more information about Gmail for business, see the official Gmail help page for business.
About each Auto-step
Auto-steps related to Gmail include [Start: Gmail: Email Message Received], [Gmail: Get Email Message], and [Gmail: Remove Label from Email Message] which are included as standard in Advanced and higher editions.
First, I will briefly explain each auto-step.
Start: Gmail: Email Message Received
A Process is started when an email with the specified label is received in Gmail. By specifying the label in advance, you can target only the received emails that meet the conditions. In the newly started Process, the email ID is stored in a Data Item.
Gmail: Get Email Message
Acquires the information of the email specified by ID and stores it in Data Items.
Gmail: Remove Label from Email Message
Removes the specified label from the email specified by an email ID.
To use these auto-steps, Questetra BPM Suite Gmail Items must be set as a trusted app in your Google Workspace security settings. Follow the procedure below to configure.
Google Workspace security settings
(Please proceed with the following operation with an account that has administrative privileges in your Google Workspace)
First, log in to the Google Admin Console (admin.google.com). Go to [Security] > [API Control] on the side menu, then click “MANAGE THIRD-PARTY APP ACCESS” on the screen.
Select [OAuth App Name Or Client ID] in the [Configure new app] dropdown, enter “13039123046-t87nmrj499ffoa58asehks3asajvgqnh.apps.googleusercontent.com“, then click [SEARCH].
When “Questetra BPM Suite Gmail Items” is displayed, select it, then check the box and click [SELECT].
Check the button next to “Trusted: Can access all Google services” and click [CONFIGURE] to complete the settings.
Now the security settings are completed.
Google and Questetra integration settings
I will explain how to set up integration between Questetra and Gmail.
- The System Administrator privilege is required to set up HTTP Authorization settings
- The registered HTTP Authorization settings are also shared with other Apps on the same workflow platform
- To avoid security and privacy issues, we recommend that you have a dedicated account instead of an individual account
- (Depending on the C2: label settings, all incoming emails may be imported into the workflow by other Apps)
After placing the aforementioned automatic Step in Questetra’s workflow App editing screen, open its property screen. When you click the [Set up Settings] button below C1: OAuth2 settings item in the [Start: Gmail: Email Message Received] icon, the HTTP authentication settings Gmail API (Readonly) settings screen will open.
Click [Add] on the screen and specify a name of your choice. (Arbitrary string: it’s better to give a name that is easy to understand later.)
Click [Get Token] in the added setting to move to the Google authentication screen.
Sign in with the account whose inbox is to be monitored and Allow the request.
You now have obtained a token for OAuth2 authentication with Gmail. You can confirm it by checking the “○ (refresh token)” indicator above the [Get Token] button.
Go back to the [Start: Gmail: Email Message Received] settings and select the setting name that was added in C1: OAuth2 settings.
Gmail label settings
I will explain the settings in Gmail. Make a configuration to label the emails that arrive in your Gmail account that you want to launch Questetra.
There are two types of labels: default labels called System Labels, and labels that you can add/edit arbitrarily. System labels include INBOX, STARRED, and IMPORTANT. Of these, STARRED is used in this App.
We will use another label. Here, we will create a label titled Questetra and set the conditions so that emails containing the string “questetra” will be labelled with both this label and STARRED. To create a new label, click [More] to expand the left menu and select [+ Create new label] at the bottom. Type “Questetra” in the name for New label and click [Create] to complete the process, but be sure to enter the correct text since it will be used later in the workflow application settings.
Next, set the conditions to be given to the incoming mail. Open the settings page with [Gear Icon] > [See all settings] at the top right of the screen, and select [Filters and Blocked Addresses]. Click on Create a new filter to set the conditions to filter the target emails. In this example, enter questetra in “Has the words”, then click Create Filter. (It is not case sensitive here.) Next, specify the operation on the determined email. In this example, check Star it and Apply the label, specify Questetra from Choose label, and click [Create Filter] to complete. With these settings, emails with questetra in the subject or body can now be labelled as STARRED and Questetra.
Below is the Workflow Diagram of an example App using these auto-steps.
This App monitors the Gmail account, and when an email with the specified conditions is received it automatically starts a Process and saves the information contained in the email as Process data. Gmail’s “label” is used as a condition to specify an email.
Workflow App settings
The Start event Gmail Start will regularly monitor incoming emails as they are received, and start a workflow Process when it detects newly arrived emails labeled with a star and Questetra. In the following Step, Save Email Info, the email information is set in the Data Items. At the Remove Star step, the star is removed from the read email. By doing this you can see that emails without a star in the Gmail list have already been taken into the workflow. You can browse the information obtained at the Confirmation Step.
Data Items settings
The Data Items settings are as follows.
|Data Item Name||Data-type||Required||[Confirm] Step||Description|
|Title||–||No||Display only||The title of the Process|
|Email ID||String-type (single line)||No||Display only||The ID of an individual email in Gmail. (Different from Message ID)|
|From Address||String-type (single line)||No||Display only||The From address of the email|
|From Name||String-type (single line)||No||Display only||The From name of the email|
|To/Cc/Bcc Address||String-type (multiple lines)||No||Display only||The To/Cc/Bcc addresses of the email|
(In Bcc, only your address is saved)
|To/Cc/Bcc Name||String-type (multiple lines)||No||Display only||The To/Cc/Bcc Name of the email|
|Received Time||Datetime-type||No||Display only||The received time of the email|
|Email Subject||String-type (single line)||No||Display only||The subject of the email|
|Email Body||String-type (multiple lines)||No||Display only||The body of the email|
|Attachment||File-type||No||Display only||The file attached to the email|
|RFC 822 Message-ID header||String-type (single line)||No||Display only||The Message Id of the email|
The Email ID acquired at the Gmail Start event will be used in the subsequent Save Email Info and Remove Star Steps.
Gmail Start (Start: Gmail: Email Message Received) settings
Settings in Gmail Start are as follows.
|C1: OAuth2 Setting||Yes||Specify the HTTP Authorization Setting name for connecting to Gmail APIs. You need to get the OAuth2 token in advance with the setting name to be specified. (Refer to “Google and Questetra integration settings” ).|
|C2: Label||No||The received email that starts a Process is narrowed down by the presence or absence of the specified label here. If you want to specify multiple labels, separate them with a line break. If left blank, all emails that arrive in your inbox will start a Process.|
In this example type;
(Please be aware they are case sensitive)
|C3: Data item to save Message ID||Yes||Select the Email ID Data Item to be specified|
|C4: Data item to save received time||No||Select the Received Time Data Item to be specified|
|C5: Data item to save RFC 822 Message-ID header||No||Select the RFC 822 Message-ID header Data Item to be specified|
Once the App is released, it will start monitoring your authenticated account Gmail inbox. The first time it accesses Gmail it will only fetch the emails and will not start any Process; the second and subsequent accesses it checks the difference from the previous access, and if there is new email, a Process is started for each one.
Save Email Info (Gmail: Get Email Message) settings
Settings in Save Email Info are as follows.
|C1: OAuth2 Setting||Yes||Select the same setting name as you set in Gmail Start|
|C2: Message ID||Yes||Select the Email ID Data Item to be specified|
The email with the ID that has been saved at Gmail Start will be the target
|C3: String type data item that will save From Address||No||Hereinafter, select a prepared Data Item to be specified respectively|
|C4: String type data item that will save From Name||No|
|C5: String type data item that will save To/Cc/Bcc Addresses||No|
|C6: String type data item that will save To/Cc/Bcc Names||No|
|C7: Datetime type data item that will save Sent Date and Time||No|
|C8: String type data item that will save Subject||No|
|C9: String type data item that will save Body||No|
|C10: File type data item that will save Attachments||No|
At the Save Email Info Step following the Gmail Start, the contents of the email that triggered the start of the Process are acquired and saved in Data Items.
Remove Star (Gmail: Remove Label from Email Message) settings
Settings in Remove Star are as follows.
|C1: OAuth2 Setting||Yes||Add another HTTP Authorization setting according to the Google integration settings procedure described above|
As the scope of the API is different, the setting you added previously cannot be used
|C2: Message ID||Yes||Select the Email ID Data Item to be specified|
|C3: Labels to remove||Yes||Type;|
STARRED (Uppercase letter)
When removing multiple labels separate them with a line break
Once the email has been saved it proceeds to the Remove Star Step. There, the star added by the settings in Gmail is removed. By doing this, you can see on Gmail’s email list screen that saving with Questetra has been completed.
Once the auto-steps are completed, you can check the email contents at the Confirm Step.
3 thoughts on “Starting a Process Triggered by Receiving a Gmail”
Pingback: Start: Gmail: Email Message Received – Questetra Support
Pingback: Gmail: Get Email Message – Questetra Support
Pingback: Gmail: Remove Label from Email Message – Questetra Support
Comments are closed.