Guide
n8n Gmail inbox automations
Download four n8n workflows that create Gmail labels, organise new and old messages, and send a daily summary.
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
02
Sort new email
03
Sort old email
04
Send a daily summary
2 of 4
Connect Gmail
You need one free Google Cloud project and one Gmail credential in n8n.
First, set up Google Cloud
- Open the Google Cloud project page. Name the project
n8n Automations, then click Create.
- In that project, open the Gmail API page and click Enable.
- In n8n, open workflow 01, click Get Recent Gmail Messages, then choose Create new credential. Copy the OAuth Redirect URL that n8n shows you.
- 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.
Then, connect n8n
- 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.
- Click Create. Copy the Client ID and Client secret before closing the window.
- Paste both values into the Gmail credential in n8n. Click Sign in with Google, choose your test-user account, then save the credential.
Google changed these screens recently. If a label has moved, use n8n's current Gmail credential guide.
2 of 4
Connect Outlook
Outlook uses a Microsoft app registration. You only need to create it once.
- In n8n, open workflow 01 and click Fetch Emails (Page 1). Choose Create new credential and copy n8n's OAuth callback URL.
- Open Microsoft App registrations, click New registration, and allow work, school and personal Microsoft accounts.
- Choose Web for the redirect URI and paste n8n's callback URL.
- Copy the Application (client) ID. Open Certificates & secrets, create a client secret, and copy its Value.
- Paste both values into n8n, click Connect my account, and save the credential.
Need the full Microsoft screens? Follow n8n's Microsoft credential guide or Microsoft's app registration guide.
3 of 4
Connect Replicate
Replicate runs the AI model. Store its token as an n8n credential, not inside a node.
- Open Replicate API tokens and copy your token.
- In n8n, open Credentials, click Add credential, and search for HTTP Bearer Auth.
- Name it
Replicate Bearer. Paste the token into Bearer Token. Paste the token only. Do not add the wordBearer. - 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.
AI Suggests Gmail LabelsClassify New Gmail MessageClassify Existing Gmail MessageAI Summarizes Unread GmailAI Suggests FoldersClassify New Email (API)Classify Email (API)AI Summarize (GPT-5.6 Luna)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.
In Outlook workflow 04, open ⚙️ Settings (Summary). Replace REPLACE_WITH_YOUR_EMAIL_ADDRESS beside recipientEmail.
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.
In Outlook workflow 03, open ⚙️ Settings (Bulk). Use skip: 0 and BATCH_SIZE = 50 for the newest 50. Change skip to 50 for the next 50.
Test in this order
- Run 01 by hand. Check the new labels.
- Send yourself a test email, then run 02.
- Run 03 on ten old emails first. Check which label each message received.
- Run 04. Confirm the summary reaches your email address.
- Activate 02 and 04. Keep 01 and 03 inactive and run them only when needed.
Quick Gmail fixes
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.
