This workflow follows the Gmail → Gmail Trigger recipe pattern — see all workflows that pair these two integrations.
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 →
{
"name": "My workflow",
"nodes": [
{
"parameters": {
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"filters": {}
},
"type": "n8n-nodes-base.gmailTrigger",
"typeVersion": 1.4,
"position": [
0,
-96
],
"id": "cc55c1b0-49cc-4680-bc30-633092ad7de0",
"name": "Gmail Trigger",
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"method": "POST",
"url": "https://YOUR_NGROK_URL/predict",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"text\": \"{{ $json.Subject }} {{ $json.snippet }}\"\n}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
224,
-96
],
"id": "2a0dbe5e-806b-4b36-98f7-0ae977f673cb",
"name": "HTTP Request"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "ff6b2de5-d80c-424f-b35b-fd1814666901",
"leftValue": "={{ $('HTTP Request').item.json.prediction }}",
"rightValue": "SPAM",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
448,
-96
],
"id": "726aadc4-0434-4b2f-b669-ed6a7fd972be",
"name": "If"
},
{
"parameters": {
"operation": "addLabels",
"messageId": "={{ $('Gmail Trigger').item.json.id }}",
"labelIds": [
"SPAM"
]
},
"type": "n8n-nodes-base.gmail",
"typeVersion": 2.2,
"position": [
672,
-96
],
"id": "ab042d8c-08ee-4a86-8cf2-212e186fc802",
"name": "Add label to message",
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
}
}
],
"connections": {
"Gmail Trigger": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"If": {
"main": [
[
{
"node": "Add label to message",
"type": "main",
"index": 0
}
]
]
}
},
"active": true,
"settings": {
"executionOrder": "v1",
"binaryMode": "separate"
},
"versionId": "dcf0a06c-a106-4b31-9ef4-1be5145097b1",
"meta": {
"templateCredsSetupCompleted": true
},
"nodeGroups": [],
"id": "8DWemzcmQKN9PaQH",
"tags": []
}
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
About this workflow
Spam-Ham-N8N. Uses gmailTrigger, httpRequest, gmail. Event-driven trigger; 4 nodes.
Source: https://github.com/alimasroorkhan/spam-ham-n8n/blob/51d3a5cf8017694e72230ccfebefb3dfb9c7e6e4/N8N/spam-ham-n8n.json — 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.
InquiryPilot - Gmail to Sheets and Draft. Uses gmailTrigger, httpRequest, googleSheets, gmail. Event-driven trigger; 4 nodes.
This workflow ingests proof-of-delivery and completion documents from Gmail or a webhook, extracts key fields with an OpenRouter vision model, reconciles them against Google Sheets dispatch data, arch
AICARE Email Blast System. Uses googleDrive, httpRequest, googleSheets, gmail. Event-driven trigger; 39 nodes.
Client Form → Draft → Approve → Sign → Deliver, fully automated
ResultAnalyser. Uses gmailTrigger, executeCommand, httpRequest, gmail. Event-driven trigger; 23 nodes.