Gmail Inbox Triage
Module 06 · business · intermediate
starter.json
In n8n, copy this file and paste it onto the canvas, or use Import from File.
{
"name": "06 - Gmail Inbox Triage (starter)",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "triage",
"responseMode": "responseNode",
"options": {}
},
"id": "m06-webhook",
"name": "Triage API",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
0,
300
],
"webhookId": "course-06-triage"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "t1",
"leftValue": "={{ ($json.body.subject ?? '') + ($json.body.text ?? '') }}",
"rightValue": "",
"operator": {
"type": "string",
"operation": "notEmpty",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"id": "m06-valid",
"name": "Has Content?",
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
220,
300
]
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{ { error: 'send at least a subject or text' } }}",
"options": {
"responseCode": 400
}
},
"id": "m06-400",
"name": "Respond Bad Input",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [
440,
450
]
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "p1",
"name": "message_id",
"value": "={{ $json.id ?? '' }}",
"type": "string"
},
{
"id": "p2",
"name": "from",
"value": "={{ $json.From ?? $json.body?.from ?? '' }}",
"type": "string"
},
{
"id": "p3",
"name": "subject",
"value": "={{ $json.Subject ?? $json.body?.subject ?? '' }}",
"type": "string"
},
{
"id": "p4",
"name": "text",
"value": "={{ ($json.snippet ?? $json.body?.text ?? '').slice(0, 3000) }}",
"type": "string"
}
]
},
"options": {}
},
"id": "m06-prepare",
"name": "Prepare Email",
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
440,
100
]
},
{
"parameters": {
"content": "## Your task\n1. Add an **Information Extractor** with an **OpenAI Chat Model** (gpt-5-mini). Extract `category` (sales/support/billing/newsletter/personal/other), `urgent` (boolean), `summary`.\n2. Clean the result into one item (**Triage Result**), forcing unknown categories to `other`.\n3. Respond with the result when called via the API.\n4. Add a **Gmail Trigger** (unread, every minute) feeding Prepare Email, and label each email by category.\n\nTest: `WITH_CREDS=1 ./test/test.sh`",
"height": 260,
"width": 420
},
"id": "starter-task-note",
"name": "Your Task",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
0,
-340
]
}
],
"connections": {
"Triage API": {
"main": [
[
{
"node": "Has Content?",
"type": "main",
"index": 0
}
]
]
},
"Has Content?": {
"main": [
[
{
"node": "Prepare Email",
"type": "main",
"index": 0
}
],
[
{
"node": "Respond Bad Input",
"type": "main",
"index": 0
}
]
]
},
"Prepare Email": {
"main": [
[]
]
}
},
"pinData": {},
"settings": {
"executionOrder": "v1"
}
}