AI spam filter for contact forms

AI checks every form message and only real inquiries reach your team.

Medium Saves ~3 hours/month Sales & CRMBy Flowngn team

Works with n8n · Make · Zapier

How it works

Trigger: Webhook — contact form submitted
  1. Receive the form message.
  2. Ask an AI model: is this spam, a sales pitch, or a real inquiry?
  3. Post real inquiries to #leads; ignore the rest.

Diagram

trueForm messageWebhookCheck for spamBasic LLM ChainClaude modelAnthropic Chat Mo…⑂Real inquiry?IfSPost to #leadsSlack
Trigger App Logic AI

Build it

Pick your tool — same automation, step by step.

Copy and paste straight into an n8n canvas (Ctrl+V), or download and use Import from File. Then connect your own credentials and replace every YOUR_… placeholder. AI steps use a Claude model node — swap it for OpenAI, Gemini or Ollama if you prefer.

Workflow JSON
Show code (174 lines)
{
  "name": "AI spam filter for contact forms (Flowngn)",
  "nodes": [
    {
      "parameters": {
        "content": "## AI spam filter for contact forms\nAI checks every form message and only real inquiries reach your team.\n\n**Setup**\n1. Open each node and connect your own credentials.\n2. Replace every YOUR_… placeholder.\n3. Test once, then activate.\n\nFree template from Flowngn",
        "height": 260,
        "width": 340
      },
      "id": "292cf932-28a7-4c4a-adbb-f824f0f5ffd3",
      "name": "Setup notes",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -420,
        -60
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "contact-filtered",
        "options": {}
      },
      "id": "292cf932-28a7-4c4a-adbb-f824f0f5ffd3",
      "name": "Form message",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        0
      ],
      "webhookId": "292cf932-28a7-4c4a-adbb-f824f0f5ffd3"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Classify this website contact form message. Answer with one word: REAL (a genuine inquiry from a potential customer or partner), PITCH (someone selling SEO, marketing, dev services, etc.) or SPAM.\n\n{{ JSON.stringify($json.body) }}"
      },
      "id": "292cf932-28a7-4c4a-adbb-f824f0f5ffd3",
      "name": "Check for spam",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.5,
      "position": [
        300,
        0
      ]
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "claude-sonnet-5",
          "mode": "list"
        },
        "options": {}
      },
      "id": "292cf932-28a7-4c4a-adbb-f824f0f5ffd3",
      "name": "Claude model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "typeVersion": 1.3,
      "position": [
        300,
        220
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "c1",
              "leftValue": "={{ $json.text.toUpperCase() }}",
              "rightValue": "REAL",
              "operator": {
                "type": "string",
                "operation": "contains"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "292cf932-28a7-4c4a-adbb-f824f0f5ffd3",
      "name": "Real inquiry?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        600,
        0
      ]
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": {
          "__rl": true,
          "value": "#leads",
          "mode": "name"
        },
        "text": "=📬 {{ $('Form message').item.json.body.name }} ({{ $('Form message').item.json.body.email }})\n{{ $('Form message').item.json.body.message }}",
        "otherOptions": {}
      },
      "id": "292cf932-28a7-4c4a-adbb-f824f0f5ffd3",
      "name": "Post to #leads",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.2,
      "position": [
        900,
        0
      ]
    }
  ],
  "connections": {
    "Form message": {
      "main": [
        [
          {
            "node": "Check for spam",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check for spam": {
      "main": [
        [
          {
            "node": "Real inquiry?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Real inquiry?": {
      "main": [
        [
          {
            "node": "Post to #leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claude model": {
      "ai_languageModel": [
        [
          {
            "node": "Check for spam",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}

Open in the playground to edit →

Tips

  • Log spam to a sheet for a week to check nothing real is filtered out.

Related flows