The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"nodes": [
{
"id": "b1afd02d-6edf-4540-bf32-09d87cb8a27b",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
320,
220
],
"parameters": {
"color": 5,
"width": 379,
"height": 80,
"content": "### \ud83d\udc68\u200d\ud83c\udfa4 Setup\n1. Add your Gmail creds"
},
"typeVersion": 1
},
{
"id": "3481e6c3-7706-4c7f-8ca6-c96f76d82021",
"name": "At midnight every work day",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
400,
340
],
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "0 0 * * 1-5"
}
]
}
},
"typeVersion": 1
},
{
"id": "3c74e4fd-e919-4acb-8092-658f2e71513b",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
380,
520
],
"parameters": {
"color": 7,
"width": 202,
"height": 100,
"content": "\ud83d\udc46 Set your schedule. I use this for work emails. For personal emails, I run this daily."
},
"typeVersion": 1
},
{
"id": "de421702-d012-4ea1-826e-1a4756ff4856",
"name": "Get all emails in the last day",
"type": "n8n-nodes-base.gmail",
"position": [
620,
340
],
"parameters": {
"filters": {
"q": "label:inbox",
"receivedBefore": "={{ $now.minus({days: 1}) }}"
},
"resource": "thread",
"returnAll": true
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 2
},
{
"id": "ef43b756-5f9c-4c8d-830a-8ccb71562618",
"name": "Get the thread of each email",
"type": "n8n-nodes-base.gmail",
"position": [
840,
340
],
"parameters": {
"options": {},
"resource": "thread",
"threadId": "={{ $json.id }}",
"operation": "get"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 2
},
{
"id": "bfc3b7e1-651a-4eb5-8882-b21d120d982b",
"name": "Keep only starred emails in inbox",
"type": "n8n-nodes-base.filter",
"position": [
1060,
340
],
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{ JSON.stringify($json.messages).includes('STARRED') }}"
}
]
}
},
"typeVersion": 1
},
{
"id": "3d8145dc-577d-4e9b-83a7-fdf06afa1b96",
"name": "for each message in the thread",
"type": "n8n-nodes-base.itemLists",
"position": [
1480,
520
],
"parameters": {
"options": {},
"fieldToSplitOut": "messages"
},
"typeVersion": 2
},
{
"id": "1a9083a8-ffd2-403e-bf53-9b9eee87ff5b",
"name": "Archive message (remove from inbox)",
"type": "n8n-nodes-base.gmail",
"position": [
1700,
520
],
"parameters": {
"labelIds": "=INBOX",
"messageId": "={{ $json.id }}",
"operation": "removeLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 2
},
{
"id": "c51240d0-88cb-461b-82ba-929a2d8a9dde",
"name": "Archive thread (remove from inbox)",
"type": "n8n-nodes-base.gmail",
"position": [
1340,
300
],
"parameters": {
"labelIds": "=INBOX",
"resource": "thread",
"threadId": "={{ $json.id }}",
"operation": "removeLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 2
},
{
"id": "3ca7074f-c912-456c-92e4-08cac8833471",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
1060,
520
],
"parameters": {
"color": 7,
"width": 202,
"height": 100,
"content": "\u2b50 Keep starred emails in inbox.. Archive everything else!"
},
"typeVersion": 1
}
],
"connections": {
"At midnight every work day": {
"main": [
[
{
"node": "Get all emails in the last day",
"type": "main",
"index": 0
}
]
]
},
"Get the thread of each email": {
"main": [
[
{
"node": "Keep only starred emails in inbox",
"type": "main",
"index": 0
}
]
]
},
"Get all emails in the last day": {
"main": [
[
{
"node": "Get the thread of each email",
"type": "main",
"index": 0
}
]
]
},
"for each message in the thread": {
"main": [
[
{
"node": "Archive message (remove from inbox)",
"type": "main",
"index": 0
}
]
]
},
"Keep only starred emails in inbox": {
"main": [
[
{
"node": "Archive thread (remove from inbox)",
"type": "main",
"index": 0
},
{
"node": "for each message in the thread",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
gmailOAuth2
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
How this works
This workflow automates the daily management of your Gmail inbox by identifying and archiving starred emails from workdays, freeing you from manual sorting and ensuring important messages are safely organised without cluttering your primary view. It suits professionals or teams handling high email volumes who rely on starring to flag priorities, delivering a clean inbox each morning to boost focus and productivity. The key step involves fetching recent emails, filtering for starred ones in threads, and archiving them via Gmail integration, with itemLists handling the loop through messages efficiently.
Use this workflow when you want a hands-off routine for processing starred emails at midnight on weekdays, particularly if your inbox mixes urgent and routine correspondence. Avoid it for non-Gmail users or those needing custom criteria beyond starring, such as keyword-based filtering. Common variations include adjusting the cron schedule for different times or adding notifications through another integration like Slack for archived items.
About this workflow
Schedule Filter. Uses stickyNote, scheduleTrigger, gmail, itemLists. Scheduled trigger; 10 nodes.
Source: https://github.com/Zie619/n8n-workflows — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Wait Code. Uses httpRequest, htmlExtract, itemLists, scheduleTrigger. Scheduled trigger; 15 nodes.
YOUR_ID 4. Uses gmail, googleDrive, googleSheets, httpRequest. Scheduled trigger; 53 nodes.
14310 Send Overdue Invoice Payment Reminders With Ifirma Gmail Postgrid And Slack. Uses httpRequest, stopAndError, slack, gmail. Scheduled trigger; 53 nodes.
Code. Uses googleSheets, gmail, supabase, stickyNote. Webhook trigger; 51 nodes.
Addendo — Blog Automatico Don Jacinto Nahual. Uses httpRequest, redis, github, gmail. Scheduled trigger; 51 nodes.