Nettoyeur automatique de spam et d'e-mails marketing

Intermédiaire

Ceci est unOther, Support, AIworkflow d'automatisation du domainecontenant 6 nœuds.Utilise principalement des nœuds comme If, Gmail, GmailTrigger, Agent, LmChatOpenAi, combinant la technologie d'intelligence artificielle pour une automatisation intelligente. Automatiser le filtrage du spam avec GPT-4 et Gmail

Prérequis
  • Compte Google et informations d'identification Gmail API
  • Clé API OpenAI
Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "id": "3QJW0AkGeIq3ofcC",
  "meta": {
    "instanceId": "740c1df6d3b1b6ea8a9d2223701f6904173f9e3cf7381cd181644b043420ba09",
    "templateCredsSetupCompleted": true
  },
  "name": "Auto Spam & Marketing Email Killer",
  "tags": [],
  "nodes": [
    {
      "id": "83cad1fb-1c94-4fa6-abc6-fc9084e84b8a",
      "name": "Déclencheur Gmail",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -80,
        60
      ],
      "parameters": {
        "filters": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyHour"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "ECavbdGSgi3lNgZG",
          "name": "Gmail account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "38c3a768-5152-4377-9fa7-065e58233ef2",
      "name": "Modèle de chat OpenAI",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        160,
        280
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-nano",
          "cachedResultName": "gpt-4.1-nano"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "69YTGxdIPy79gAdh",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4acc776b-0554-4a74-b10a-5307ee14fee2",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        520,
        60
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "3fa478cd-9476-4a10-b039-1e537b838b31",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.output }}",
              "rightValue": "SPAM"
            },
            {
              "id": "82bafdff-daed-4791-8dd0-dae981c0ee43",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.output }}",
              "rightValue": "OFERTA"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "a2440f83-73b8-4757-90cf-c0f4d269eb9b",
      "name": "Validator of E-mail",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        160,
        60
      ],
      "parameters": {
        "text": "=Your email too check:\n {{ $json.snippet }}",
        "options": {
          "systemMessage": "=You are an intelligent assistant for analyzing and classifying email messages or contact forms.\n\nYour task is to carefully evaluate whether the message contains valuable information, or whether it is a standard marketing message with no real value to the recipient.\n\nWe distinguish three classes:\n\nSPAM – bulk messages, low-quality content, random text, scams, phishing, etc.\n\nOFFER – commercial or marketing messages that promote something but do not contain important information for the user, e.g.:\n\nDiscount coupons\n\nPromotion or sale notifications\n\nAbandoned cart reminders\n\nEncouragement to sign up, download, or buy\n\nCold emails and collaboration offers\n\nIMPORTANT – messages containing valuable or relevant information for the recipient, even if commercial in nature, e.g.:\n\nOrder or payment confirmation\n\nShipping or delivery status updates\n\nMessage from a specific person with a question or request\n\nPersonal matters, invitations, inquiries\n\nRules:\n\nIf you're unsure, better to classify as IMPORTANT.\n\nFocus on the message content, do not judge by the email address or headers.\n\nRespond with only one word: SPAM, OFFER, or IMPORTANT.\n\nExamples:\n\nMessage:\n“Your order #14235 has been shipped. Estimated delivery: Thursday.”\nAnswer: IMPORTANT\n📌 This is relevant information for the user – do not remove.\n\nMessage:\n“You left something in your cart! Only today –15% off your purchase!”\nAnswer: OFFER\n📌 Typical marketing reminder, no actual value.\n\nMessage:\n“Hi, we noticed you didn’t download our free e-book. Download now to discover 10 ways to boost sales.”\nAnswer: OFFER\n📌 Marketing prompt, lacks valuable content.\n\nMessage:\n“Attached is the invoice for the service completed last month. Please contact me with any questions.”\nAnswer: IMPORTANT\n📌 Invoice = important message.\n\nMessage:\n“Today only! Free shipping and discounts up to 30% in our store!”\nAnswer: OFFER\n📌 Promotion, typical sales message.\n\nMessage:\n“Hi, I saw your listing online and I’m interested in working with you. Can we talk by phone?”\nAnswer: IMPORTANT\n📌 Message from a real person = potential lead.\n\nMessage:\n“Win a new iPhone! Click here to claim your prize!”\nAnswer: SPAM\n📌 No need to explain – scam/spam.\n\nMessage:\n“I’d like to ask if you offer individual training sessions?”\nAnswer: IMPORTANT\n📌 A real inquiry from a potential customer.\n\nMessage:\n“Register now for free 7-day access to XYZ tool.”\nAnswer: OFFER\n📌 Advertising offer, not inherently important."
        },
        "promptType": "define"
      },
      "typeVersion": 1.9
    },
    {
      "id": "77b25fbd-4093-48d1-9230-6a765d60b928",
      "name": "Delete E-mail",
      "type": "n8n-nodes-base.gmail",
      "position": [
        760,
        60
      ],
      "webhookId": "8c6da755-63e5-43e6-a22b-c189a72e7e7b",
      "parameters": {
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "operation": "delete"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "ECavbdGSgi3lNgZG",
          "name": "Gmail account 2"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "a994bc19-d3fd-43b0-8612-bb9dfdceff08",
      "name": "Note adhésive",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        940,
        40
      ],
      "parameters": {
        "width": 560,
        "height": 660,
        "content": "## 🧹 Auto Spam & Marketing Email Killer\n\nTired of promotional clutter in your inbox?  \nThis AI-powered n8n workflow automatically scans your Gmail inbox every hour, analyzes incoming messages using GPT-4, and deletes unwanted emails labeled as **SPAM** or **OFERR**.\n\n### 🔍 What it does\n- Triggers on new Gmail messages\n- Uses OpenAI to classify the message as: `IMPORTANT`, `OFFER`, or `SPAM`\n- Deletes emails marked as `SPAM` or `OFFER`\n- Keeps important messages like order confirmations, invoices, and personal inquiries\n\n### 🤖 Built-in Intelligence\nThe AI agent is trained with 9 real examples to ensure precise classification of marketing emails, phishing, cold outreach, and more.\n\n### 📦 Ideal for:\n- Solopreneurs\n- Business inboxes\n- Clean-inbox enthusiasts\n\nSet it once, and enjoy a distraction-free email experience.\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "0bbcd957-fdb2-4d3d-ac6b-f25903bbe301",
  "connections": {
    "4acc776b-0554-4a74-b10a-5307ee14fee2": {
      "main": [
        [
          {
            "node": "Delete Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Validator of Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Validator of Email",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Validator of Email": {
      "main": [
        [
          {
            "node": "4acc776b-0554-4a74-b10a-5307ee14fee2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Intermédiaire - Autres, Support, Intelligence Artificielle

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Informations sur le workflow
Niveau de difficulté
Intermédiaire
Nombre de nœuds6
Catégorie3
Types de nœuds6
Description de la difficulté

Adapté aux utilisateurs expérimentés, avec des workflows de complexité moyenne contenant 6-15 nœuds

Auteur
LukaszB

LukaszB

@lukaszb

AI Automation Expert | Web & Mobile App Integrator With 2+ years of experience, I build smart automations, web & mobile app workflows, and scalable platforms using tools like n8n, Make, and more. I help businesses reduce operational costs, save time, and scale faster with AI-powered solutions. For business enquiries, send me an email at kontakt@lumizone.pl

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34