@stevie_builds
Home

Guide

n8n Gmail inbox automations

Download four n8n workflows that create Gmail labels, organise new and old messages, and send a daily summary.

Contents
  1. 1Download the Gmail workflows
  2. 2Connect Gmail
  3. 3Connect Replicate
  4. 4Change, test and activate

These four workflows organise your Gmail inbox without deleting anything. Download the files, import them, then follow the setup below.

1 of 4

Download the Gmail workflows

Choose your email provider. Every download and instruction below will match it.

The guide now shows Gmail instructions.

In n8n, open Workflows, choose Import from File, and import all four files. Leave them inactive for now.

01

Create smart labels

Reads recent email and builds useful labels.

02

Sort new email

Sorts each new Gmail message when it arrives.

03

Sort old email

Works through old Gmail email in ranges you control.

04

Send a daily summary

Sends one summary of your unread email each morning.

2 of 4

Connect Gmail

You need one free Google Cloud project and one Gmail credential in n8n.

First, set up Google Cloud

  1. Open the Google Cloud project page. Name the project n8n Automations, then click Create.
The project name is only for you. Tap any image in this guide to enlarge it.
  1. In that project, open the Gmail API page and click Enable.
Make sure your n8n project is selected at the top.
  1. In n8n, open workflow 01, click Get Recent Gmail Messages, then choose Create new credential. Copy the OAuth Redirect URL that n8n shows you.
Your address starts with your own n8n URL. Copy the full address.
  1. In Google Cloud, open Google Auth Platform. Add an app name and contact email under Branding. Under Audience, use External, keep the app in testing, and add your Gmail address as a test user.
If you skip this, Google may block your own sign-in while the app is in testing.

Then, connect n8n

  1. In Google Auth Platform, open Clients and create an OAuth client. Choose Web application. Leave JavaScript origins empty. Under Authorized redirect URIs, paste the URL you copied from n8n.
The redirect URI must match n8n exactly.
  1. Click Create. Copy the Client ID and Client secret before closing the window.
Do not share the client secret or put it inside a workflow.
  1. Paste both values into the Gmail credential in n8n. Click Sign in with Google, choose your test-user account, then save the credential.
One Gmail credential can be reused across all four workflows.

Google changed these screens recently. If a label has moved, use n8n's current Gmail credential guide.

3 of 4

Connect Replicate

Replicate runs the AI model. Store its token as an n8n credential, not inside a node.

  1. Open Replicate API tokens and copy your token.
  2. In n8n, open Credentials, click Add credential, and search for HTTP Bearer Auth.
  3. Name it Replicate Bearer. Paste the token into Bearer Token. Paste the token only. Do not add the word Bearer.
  4. Save it. Never paste this token into a header, code node or exported workflow.

Choose it inside each Gmail AI node

Open the named node, find Credential for HTTP Bearer Auth, and select Replicate Bearer.

WorkflowGmail AI node
01AI Suggests Gmail Labels
02Classify New Gmail Message
03Classify Existing Gmail Message
04AI Summarizes Unread Gmail

4 of 4

Change, test and activate

Change your email address

In Gmail workflow 04, open Gmail Summary Settings. Replace REPLACE_WITH_YOUR_EMAIL_ADDRESS beside recipient.

Choose which old emails to sort

In Gmail workflow 03, open Gmail Backfill Settings. Set startEmail and endEmail. Positions are counted from newest to oldest: 1–50 sorts the newest 50; 51–100 sorts the next 50.

A full Gmail batch should carry all 50 items through the classification path, not just one.

Test in this order

  1. Run 01 by hand. Check the new labels.
  2. Send yourself a test email, then run 02.
  3. Run 03 on ten old emails first. Check which label each message received.
  4. Run 04. Confirm the summary reaches your email address.
  5. Activate 02 and 04. Keep 01 and 03 inactive and run them only when needed.

Quick Gmail fixes

ProblemWhat to do
Red mail nodeOpen it and choose your saved Gmail credential.
401 from ReplicateOpen the AI node and choose Replicate Bearer. Check that the token was pasted without the word Bearer.
Email stays in inboxNo existing label was a clear fit, so the workflow left it alone.
One old email sortedCheck the Gmail Backfill Settings, then run the whole workflow instead of one middle node.
No daily summaryCheck the recipient address in the settings node, then test the final send node.

More practical builds

Next, see how to build and self-host a small AI app or use my AI website design playbook.

Stuck on a step?

Message me with the node name and a screenshot of the error.