How to connect Gmail with Activepieces to automate your email

Last update: 03/09/2026

  • Activepieces connects Gmail via OAuth without directly saving the Google password.
  • Gmail triggers are scheduled and do not react instantly.
  • A specific label prevents processing all received messages.
  • It's advisable to try creating drafts before enabling automatic submissions.
How to connect Gmail with Activepieces

Have you ever found yourself spending more time sorting, forwarding, and replying to emails than working on what's truly important? Many of these tasks follow fairly predictable rules, so They can be delegated to an automation tool without having to grant manual access to the inbox each time.

Al Connect Gmail with ActivepiecesYou can use the arrival of a message, label, or attachment as the starting point of a workflow. You can also search emails, create drafts, reply to conversations, or send messages from the authorized account, all through a... OAuth connection with Google.

If your Gmail inbox is bursting at the seams, use these tricks
Related article:
If your Gmail inbox is bursting at the seams, use these tricks

What you need to connect Gmail with Activepieces

What you need to connect Gmail with Activepieces

Before you begin, you need a Google account with Gmail and access to a working instance of Activepieces, either in the cloud or installed on your own server. You don't need to provide your Gmail password to the platform or generate an application password: authorization is done via OAuth.

It is also advisable to check the following requirements:

  • Account permissions: You should be able to authorize third-party applications from your Google account.
  • Correct count: If you have multiple Google sessions open, identify which one you will use in the workflow.
  • Administrative authorization: Some Google Workspace accounts block applications that have not been approved by the administrator.
  • Accessible instance: In a self-hosted deployment, Activepieces must have a properly configured public URL.

For business automation, it may be advisable to use a specific account for the flowsThis prevents a personal account from concentrating permissions on shared processes and reduces problems when an employee leaves the team.

How to add a Gmail connection in Activepieces

User authorizing a Gmail account via OAuth in an Activepieces flow

The connection is created from any step that uses the Gmail component. You can do this while setting up a trigger or when adding an action:

  1. Go to Activepieces and open a new or existing flow.
  2. Press the trigger or add an action using the corresponding button.
  3. Find and select the piece Gmail.
  4. Choose the trigger or action you want to use.
  5. Open the connection field and press New connection or the equivalent option to add an account.
  6. Select the Google account that the automation will use.
  7. Review the requested permissions and confirm authorization.
  8. Go back to the editor and check that the connection is selected.
Exclusive content - Click Here  Introduction to Proteus: A Complete Guide for Beginners

The Google screen can display Activepieces as the requesting applicationThis is the normal behavior of OAuth connections provided by the platform. You only need to create a project in Google Cloud if your organization wants to use its own OAuth credentials and has an edition that supports this feature.

How to create a test flow with Gmail

Representation of a workflow that processes Gmail emails using Activepieces

The safest way to check the connection is to create an automation limited to one test labelThis prevents Activepieces from processing all inbox messages during setup.

First, create a label in Gmail like Activepieces-PruebaIf you need to organize your mailbox beforehand, you can check how. Use labels in Gmail.

Next, configure the flow:

  1. Select Gmail as the trigger.
  2. Choose New Labeled Email.
  3. Select the Google connection you just authorized.
  4. Indicate the label created for the test.
  5. Send an email to that account and apply the label.
  6. Run the trigger test to retrieve the message.
  7. Add a Gmail action like Send Email.
  8. Activate the option Create draft to create a draft without sending it.
  9. Map the sender, subject, or body obtained in the trigger.
  10. Try the action and check the result within Gmail.

Starting with a draft allows you to review the recipient and content before enabling actual sending. Once you've verified that the mapping works, you can disable that option and publish the flow.

Keep in mind that Gmail triggers are scheduled. Activepieces periodically checks for new messages, so a published execution may not start at the same second when the mail arrives.

What you can automate after connecting Gmail

The official Gmail template offers various triggers and actions. It's best to choose the most specific one to avoid unnecessary executions.

  • New Email: Detects new messages found in the inbox.
  • New Labeled Email: The flow starts when a specific label is added.
  • New Attachment: Detects new messages that include attachments.
  • Send Email: send a message or save it as a draft beforehand.
  • Reply to Email: respond within an existing conversation.
  • Create Draft Reply: Prepare a response for someone to review.
  • Find Email: Search for messages by sender, recipient, subject, content, date, or tag.
  • Get Email: retrieves a message using its identifier.
Exclusive content - Click Here  How to use Cursor.ai: the AI-powered code editor that's replacing VSCode

For example, you can record the sender and subject of certain messages in a spreadsheet. To set up this process, you will also need connect Google Sheets with Activepieces and map the data obtained from Gmail.

The best way to separate future automations is to use a different label for each processThis way you can decide from Gmail which messages should go into each flow without creating overly complex filters within Activepieces.

What changes when using self-hosted Activepieces

In Activepieces Cloud, authorization should work without configuring additional credentials. In a self-hosted installation, the most common cause of OAuth errors is a Incorrect public URL.

Check that the file .env Include values ​​like these:

AP_FRONTEND_URL=https://automatizaciones.ejemplo.com
AP_CLOUD_AUTH_ENABLED=true

The variable AP_FRONTEND_URL It must match the address used to open Activepieces. Avoid mixing a private IP, a local address, and a public domain, as Google needs to return to a consistent redirect URL after completing the authorization.

The variable AP_CLOUD_AUTH_ENABLED It allows the use of OAuth applications hosted by Activepieces to establish connections with external services. Its default value is trueHowever, it is advisable to check that it has not been deactivated during deployment.

After modifying these variables, recreate the containers:

docker compose up -d

If you're using a reverse proxy, also make sure it correctly transmits the HTTPS protocol and hostname. Incorrect header configuration can cause problems. redirects to HTTP, internal addresses, or incorrect domains.

How to protect and revoke the connection

A Gmail connection can read or send information on behalf of the authorized account, depending on the actions used. For this reason, you should review the permissions requested and authorize only trusted accounts.

Exclusive content - Click Here  How to disable Logitech G Hub at startup to speed up Windows

In a self-hosted installation, Activepieces uses the variable AP_ENCRYPTION_KEY To protect stored connections, keep a secure copy of this key and do not change it without planning, as it is part of the security for the credentials used by the flows.

If you stop using automation, remove the connection in Activepieces and also revoke access from the section of connections with third-party applications from your Google account. By doing so, any workflows that depend on that authorization will stop accessing Gmail until you reconnect the account.

Common errors when connecting Gmail with Activepieces

Common errors when connecting Gmail with Activepieces

These are the most common problems during setup:

  • The wrong account has been logged in: Close all other Google sessions or use a private window and recreate the connection.
  • Google blocks authorization: A Workspace account may require the administrator to allow third-party applications.
  • A redirection error appears: check that AP_FRONTEND_URL It contains the correct public domain and uses HTTPS.
  • The Google window won't open: Temporarily disables pop-up blocking or extensions that interfere with OAuth.
  • The self-hosted connection does not start: check that AP_CLOUD_AUTH_ENABLED not configured as false.
  • Email does not immediately trigger the flow: Gmail triggers are scheduled and perform periodic checks.
  • The trigger finds no messages: Check the label, use a recent email, and repeat the step test.
  • The test works, but the flow doesn't run again: Make sure you have saved and published the automation.
  • The connection stops working: Google may have revoked the token; remove the connection and reauthorize the account.
  • Attachments cause errors: Check its size and the file limit configured in the Activepieces instance.

With a properly authorized account, a well-defined label, and a test workflow that generates drafts, it is possible Automate Gmail with Activepieces in a controlled wayThe key is to start with a small process, review the retrieved data, and enable actual shipments only when the behavior is predictable.