AutomationFlowsEmail & Gmail › AI Urgent Email Detector (lite)

AI Urgent Email Detector (lite)

AI Urgent Email Detector (Lite). Uses emailReadImap, httpRequest, emailSend. Manual trigger; 9 nodes.

Manual trigger★★★★☆ complexity9 nodesEmail Read ImapHTTP RequestEmail Send
Email & Gmail Trigger: Manual Nodes: 9 Complexity: ★★★★☆ Added:

This workflow follows the Emailreadimap → Emailsend 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 →

Download .json
{
  "name": "AI Urgent Email Detector (Lite)",
  "nodes": [
    {
      "parameters": {
        "content": "## AI Urgent Email Detector (Lite)\n\nWatches your inbox (IMAP) and asks Claude whether each new email is urgent. If it is, you get an instant notification with a one-line reason.\n\nA free, single-purpose starter. The full version adds 3-way triage, ready-to-send draft replies, configurable tone/context, and error handling.",
        "height": 260,
        "width": 380
      },
      "id": "b1a2c3d4-0001-4000-8000-000000000001",
      "name": "Overview",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -520,
        -240
      ]
    },
    {
      "parameters": {
        "content": "Setup (3 things):\n1. IMAP credential on the trigger (email + app password).\n2. SMTP credential on \"Send Urgent Alert\".\n3. Anthropic API key as a Header Auth credential (header name: x-api-key) on \"Is it Urgent?\".\n\nThen set your own address in the two email fields of \"Send Urgent Alert\".",
        "height": 260,
        "width": 300
      },
      "id": "b1a2c3d4-0002-4000-8000-000000000002",
      "name": "Setup Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -520,
        40
      ]
    },
    {
      "parameters": {
        "mailbox": "INBOX",
        "postProcessAction": "read",
        "options": {}
      },
      "id": "b1a2c3d4-0003-4000-8000-000000000003",
      "name": "Check Inbox (IMAP Trigger)",
      "type": "n8n-nodes-base.emailReadImap",
      "typeVersion": 2,
      "position": [
        -200,
        0
      ],
      "credentials": {
        "imap": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const item = $input.item.json;\nlet bodyText = item.text;\nif (!bodyText && item.html) {\n  bodyText = item.html.replace(/<[^>]*>/g, ' ').replace(/\\s+/g, ' ').trim();\n}\nif (!bodyText) bodyText = '(no body content)';\nreturn {\n  json: {\n    subject: item.subject || '(no subject)',\n    fromAddress: item.from || 'unknown sender',\n    bodyPreview: bodyText.substring(0, 2000)\n  }\n};"
      },
      "id": "b1a2c3d4-0004-4000-8000-000000000004",
      "name": "Normalize Email Data",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        60,
        0
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.anthropic.com/v1/messages",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "anthropic-version",
              "value": "2023-06-01"
            },
            {
              "name": "content-type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({\n  model: \"claude-sonnet-4-6\",\n  max_tokens: 300,\n  system: \"You decide whether an email is urgent and needs the recipient's immediate attention. Respond with ONLY a valid JSON object, no markdown, no code fences: { \\\"is_urgent\\\": boolean, \\\"reason\\\": string with one short sentence }.\",\n  messages: [\n    {\n      role: \"user\",\n      content: \"From: \" + $json.fromAddress + \"\\nSubject: \" + $json.subject + \"\\nBody:\\n\" + $json.bodyPreview\n    }\n  ]\n}) }}",
        "options": {
          "timeout": 30000
        }
      },
      "id": "b1a2c3d4-0005-4000-8000-000000000005",
      "name": "Is it Urgent?",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        320,
        0
      ],
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const raw = $input.item.json;\nlet parsed;\ntry {\n  let text = raw.content && raw.content[0] && raw.content[0].text ? raw.content[0].text : '';\n  const match = text.trim().match(/\\{[\\s\\S]*\\}/);\n  if (!match) throw new Error('no json');\n  parsed = JSON.parse(match[0]);\n} catch (err) {\n  parsed = { is_urgent: false, reason: 'Could not parse AI response' };\n}\nconst original = $('Normalize Email Data').item.json;\nconst isOwnAlert = /^URGENT:/.test(original.subject || '');\nreturn {\n  json: {\n    ...original,\n    is_urgent: parsed.is_urgent === true && !isOwnAlert,\n    reason: parsed.reason || ''\n  }\n};"
      },
      "id": "b1a2c3d4-0006-4000-8000-000000000006",
      "name": "Parse Response",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        580,
        0
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "cond-urgent",
              "leftValue": "={{ $json.is_urgent }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "b1a2c3d4-0007-4000-8000-000000000007",
      "name": "Is Urgent?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        840,
        0
      ]
    },
    {
      "parameters": {
        "fromEmail": "you@example.com",
        "toEmail": "you@example.com",
        "subject": "=URGENT: {{ $json.subject }}",
        "emailFormat": "text",
        "text": "=An urgent email needs your attention.\n\nFrom: {{ $json.fromAddress }}\nSubject: {{ $json.subject }}\nWhy: {{ $json.reason }}\n\n---\nOriginal message:\n{{ $json.bodyPreview }}",
        "options": {}
      },
      "id": "b1a2c3d4-0008-4000-8000-000000000008",
      "name": "Send Urgent Alert",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [
        1120,
        -100
      ],
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "id": "b1a2c3d4-0009-4000-8000-000000000009",
      "name": "Not Urgent - Skip",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        1120,
        100
      ]
    }
  ],
  "connections": {
    "Check Inbox (IMAP Trigger)": {
      "main": [
        [
          {
            "node": "Normalize Email Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Email Data": {
      "main": [
        [
          {
            "node": "Is it Urgent?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is it Urgent?": {
      "main": [
        [
          {
            "node": "Parse Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Response": {
      "main": [
        [
          {
            "node": "Is Urgent?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Urgent?": {
      "main": [
        [
          {
            "node": "Send Urgent Alert",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Not Urgent - Skip",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "00000000-0000-4000-8000-000000000000",
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "id": "ai-urgent-email-detector-lite-001",
  "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.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

AI Urgent Email Detector (Lite). Uses emailReadImap, httpRequest, emailSend. Manual trigger; 9 nodes.

Source: https://github.com/MichaelBarabanov/n8n-templates/blob/main/ai-inbox-triage-lite/workflow-lite.json — original creator credit. Request a take-down →

More Email & Gmail workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Email & Gmail

This n8n workflow helps users easily discover nearby residential construction projects by automatically scraping and analyzing property listings from 99acres and other real estate platforms. Users can

Email Read Imap, HTTP Request, Email Send
Email & Gmail

AI HRD Screening Automation. Uses emailReadImap, httpRequest, emailSend, googleSheets. Manual trigger; 9 nodes.

Email Read Imap, HTTP Request, Email Send +1
Email & Gmail

This n8n workflow automates subdomain creation and deletion on GoDaddy using their API, triggered via email requests. This empowers developers to manage subdomains directly without involving DevOps fo

HTTP Request, Email Read Imap, Email Send
Email & Gmail

05a Inbox: Monitor + Classify Replies. Uses emailReadImap, httpRequest, postgres, emailSend. Manual trigger; 5 nodes.

Email Read Imap, HTTP Request, Postgres +1
Email & Gmail

Email Handler. Uses emailReadImap, httpRequest, emailSend. Manual trigger; 6 nodes.

Email Read Imap, HTTP Request, Email Send