Automated Discord Spam Moderation with AI and Human-in-the-Loop — n8n Workflow

High complexity Trigger23 nodes🏷️ Miscellaneous👁 831 viewsby Jimleuk

Overview

This n8n template demonstrates how you can automate community moderation using human-in-the-loop functionality for Discord.

The use-case is for detecting and dealing with spam messages in a predefined and consistent way. Human-in-the-loop allows for a balance between overly aggressive bots and time and effort from the moderation team.

How it works A scheduled trigger is used to scan the most recent messages in a Discord Channel. Messages are tagged via the "Remove Duplicates" node so they don'

Nodes used

DiscordCodeOpenAI Chat ModelText Classifier

Workflow Preview

1. Get Channel Messages
Read more about the scheduled Trigger
The scheduled trigger is used to execute this w
2. Group Messages By User
Learn more about the loop node
When dealing with nested data such as user and messag
3. Spam Detection using AI-powered Text Class
[Learn more about the text classification node](https:/
5. Moderation using Human-in-the-Loop
Read more about n8n's human-fallback functionality
In this step, we can use the "Send and Wait for
6. Execute Moderation Actions
Learn more about the Discord node
Finally, moderation actions can be executed on behalf
4. Concurrent Processing using Subworkflows
Learn more about Subworkflow Trigger
One issue we might come acros
Try it out
This n8n template demonstrates how you can automate com
The use-case is for detecting and dealing with spam mes
model
Spam Detection
Get Recent Messages
O
Only Once
Model
Warn User
Warn User Only
Group By User
F
For Each User...
S
Split Out
Message to List
Notify Moderators with S…
F
Flag as Spam
F
Flag as Not Spam
M
Merge
S
Spam Messages Only
H
Has Flagged Messages?
Get Message IDs
Delete Messages
R
Receive Instructions
M
Moderation Subworkflow
W
When Executed by Another…
N
No Action Taken
S
Schedule Trigger
23 nodes24 edges

How it Works

  1. 1

    Trigger

    The workflow starts with a trigger trigger.

  2. 2

    Process

    Data flows through 23 nodes, connecting code, discord, executeworkflow.

  3. 3

    Output

    The workflow completes its automation and delivers the result to the configured destination.

Node Details (23)

DI

Discord

discord

#1
CO

Code

code

#2
OP

OpenAI Chat Model

n8n-nodes-langchain.lmChatOpenAi

#3
TE

Text Classifier

n8n-nodes-langchain.textClassifier

#4

How to Import This Workflow

  1. 1Click Download JSON button on the right to save the workflow file.
  2. 2Open your n8n instance. Go to Workflows → New → Import from file.
  3. 3Select the downloaded automated-discord-spam-moderation-with-ai-and-human-in-the-loop file and click Import.
  4. 4Set up credentials for each service node (API keys, OAuth, etc.).
  5. 5Click Test Workflow to verify everything works, then activate it.

Or paste directly in n8n → Import from JSON:

{ "name": "Automated Discord Spam Moderation with AI and Human-in-the-Loop", "nodes": [...], ...}

Integrations

codediscordexecuteworkflowexecuteworkflowtriggerfilteriflmchatopenaimergeremoveduplicatesscheduletriggersetsplitinbatchessplitoutswitchtextclassifier

Get This Workflow

Download and import in one click

Download JSONView on n8n.io
Nodes23
Complexityhigh
Triggertrigger
Views831

Created by

Jimleuk

Jimleuk

@jimleuk

Tags

codediscordexecuteworkflowexecuteworkflowtriggerfilteriflmchatopenaimergeremoveduplicatesscheduletrigger

New to n8n?

n8n is a free, open-source workflow automation tool. Self-host it or use the cloud version.

Get n8n Free →

Related Miscellaneous Workflows