Articles on: App Connections

How to connect Gmail using oAuth app

Now you can receive emails via the Gmail API. The API provides you with a RESTful access to the features you usually have with Gmail. Google prefers API, so receiving emails via API is more stable than via IMAP.

How automation works



The trigger sends requests to the mailbox every five minutes and receives all the emails that have been received in the last hour. Each message is transferred without parsing the message body, saving all tags.

In order to receive emails via API, you need to create an oAuth application in your Google account, then copy the Client ID and the Client Secret values, paste them into Albato connection settings and grant access.

As we create a special oAuth application, we use a special Albato partner Gmail — receiving emails.

How to create app



Open Google Cloud Platform, then create or select the project.




and click ENABLE APIS AND SERVICES button:




Find and select the Gmail API in the search bar.



Click Enable button.




Now go to the APIs & Services section → OAuth consent screen select External user type and click Create button.




Open the App information section enter any name in the App name field, e.g. Albato.

In the User support email field, select your Google email address from the list. This is your private, non-public application, so no one can see it.



Skip the App domain field.

In_ Authorized domains_ section create two domains:

albato.ru
albato.com



In the Developer contact information field, enter your email address.

Click Save and continue button.

On the next page, click on the Add or remove scopes button:



In the search bar, enter Gmail API and check the boxes for the specified scopes:

https://mail.google.com/

https://www.googleapis.com/auth/gmail.labels

https://www.googleapis.com/auth/gmail.send

https://www.googleapis.com/auth/gmail.readonly

https://www.googleapis.com/auth/gmail.compose

https://www.googleapis.com/auth/gmail.insert

https://www.googleapis.com/auth/gmail.modify

https://www.googleapis.com/auth/gmail.metadata



After the access settings, click Save and continue button below.

Then click Add users button.



Add your Google email address. If necessary, you can add up to 100 email addresses that will be granted access to the application. Only the users listed here will be able to create a connection in Albato:



Then check the settings. If it is correct, then proceed to the next step and create oAuth credentials for the connection. Open the Credentials tab.

Click Create credentials button and select OAuth client ID from the list:



From the Application type list, select Web application value. In the Name field, enter the name of the application, e.g Albato.



In the Authorized redirect URIs section, click ADD URI button:



Enter the value: https://albato.ru/settings/albato-builder-600/oauth



Click Create button. After that, the application will be created and the following window will appear:



Copy Client ID and Client Secret values to create connection in Albato.



You can always go to the Credentials tab, click the pencil next to the created oAuth connection and copy the required IDs.

How to create Albato connection



Go to the Apps section, click the Add a connection button and select Gmail — receiving emails value from the list.



Enter any name for your connection, and paste the Client ID and the Client Secret values that you copied from the _Credentials_ section.



Click the Next button and grant Albato access. If connection settings are correct, the Gmail login window will appear. Select your email.

Then click the Continue button. This warning will appear:



It appears because it is a non-public application and has not been moderated. Then click the Continue button:



The connection setup is completed. Now you can create automations with this trigger, and receive new emails in origin format.

Updated on: 17/04/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!