AutomationFlowsEmail & Gmail › Gmail Spam Checker with OpenAI

Gmail Spam Checker with OpenAI

Original n8n title: Traer Emails

Traer Emails. Uses executeWorkflowTrigger, gmail, openAi. Event-driven trigger; 4 nodes.

Event trigger★★☆☆☆ complexityAI-powered4 nodesExecute Workflow TriggerGmailOpenAI
Email & Gmail Trigger: Event Nodes: 4 Complexity: ★★☆☆☆ AI nodes: yes Added:

This workflow follows the Execute Workflow Trigger → Gmail 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
{
  "nodes": [
    {
      "parameters": {
        "inputSource": "passthrough"
      },
      "id": "997ec97d-af32-4b4c-9b67-ffdcba339423",
      "typeVersion": 1.1,
      "name": "Start",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        304,
        48
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "9827375e-9818-4318-b0e3-341d7353c729",
              "name": "Subject",
              "value": "={{ $json.Subject }}",
              "type": "string"
            },
            {
              "id": "111cba93-9b6a-4b87-8569-001122a9e80f",
              "name": "labels[2]",
              "value": "={{ $json.labels[2] }}",
              "type": "object"
            },
            {
              "id": "483ef420-fffc-4292-b3fa-f3c58aa06756",
              "name": "labels",
              "value": "={{ $json.labels }}",
              "type": "array"
            },
            {
              "id": "a20521f3-f24d-47ae-98e5-ebe58ec6d730",
              "name": "From",
              "value": "={{ $json.From }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        752,
        48
      ],
      "id": "a664dc2b-bb22-4eda-a9ab-b3af3a97233b",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "operation": "getAll",
        "limit": 10,
        "filters": {
          "includeSpamTrash": false,
          "q": "jetsmart ",
          "readStatus": "both"
        }
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        528,
        48
      ],
      "id": "2e47ade0-8f24-40cb-97cc-a1b3f8cee8ad",
      "name": "Get many messages",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "gpt-4.1-nano",
          "mode": "list",
          "cachedResultName": "GPT-4.1-NANO"
        },
        "responses": {
          "values": [
            {
              "content": "=Este email es spam? Justific\u00e1 {{ $json.Subject }}"
            }
          ]
        },
        "builtInTools": {},
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 2,
      "position": [
        976,
        48
      ],
      "id": "5b40f760-1adf-4f4d-b292-a7abba75f932",
      "name": "Es spam?",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Get many messages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Es spam?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get many messages": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "meta": {
    "templateCredsSetupCompleted": true
  }
}

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

Traer Emails. Uses executeWorkflowTrigger, gmail, openAi. Event-driven trigger; 4 nodes.

Source: https://github.com/mnsosa/automatizacion-n8n/blob/2421d3534f43e49aceff37acd7e38f962940053b/templates/traer_emails.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

Splitout Googlecalendar. Uses gmail, googleCalendar, lmChatOpenAi, informationExtractor. Event-driven trigger; 61 nodes.

Gmail, Google Calendar, OpenAI Chat +5
Email & Gmail

This n8n template automatically processes inbound form leads, researches their company via their website, and uses AI to write and send a highly personalized "speed to lead" email instantly. It also t

Airtable, HTTP Request, OpenAI +2
Email & Gmail

Send A Chatgpt Email Reply And Save Responses To Google Sheets. Uses openAi, gmailTrigger, stickyNote, gmail. Event-driven trigger; 49 nodes.

OpenAI, Gmail Trigger, Gmail +2
Email & Gmail

Code. Uses openAi, gmailTrigger, stickyNote, gmail. Event-driven trigger; 49 nodes.

OpenAI, Gmail Trigger, Gmail +2
Email & Gmail

This workflow sends a OpenAI GPT reply when an email is received from specific email recipients. It then saves the initial email and the GPT response to an automatically generated Google spreadsheet.

OpenAI, Gmail Trigger, Gmail +2