This workflow follows the Discord → HTTP Request 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 →
{
"name": "Discord AI Moderator Bot",
"nodes": [
{
"parameters": {
"event": "messageCreate",
"options": {}
},
"id": "c3d4e5f6-3333-4000-8000-000000000001",
"name": "Discord Trigger",
"type": "n8n-nodes-base.discord",
"typeVersion": 2,
"position": [
240,
300
],
"credentials": {
"discordBotApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "set-content",
"name": "messageContent",
"value": "={{ $json.content }}",
"type": "string"
},
{
"id": "set-author",
"name": "authorId",
"value": "={{ $json.author.id }}",
"type": "string"
},
{
"id": "set-channel",
"name": "channelId",
"value": "={{ $json.channel_id }}",
"type": "string"
},
{
"id": "set-msg-id",
"name": "messageId",
"value": "={{ $json.id }}",
"type": "string"
},
{
"id": "set-author-name",
"name": "authorName",
"value": "={{ $json.author.username }}",
"type": "string"
}
]
},
"options": {}
},
"id": "c3d4e5f6-3333-4000-8000-000000000002",
"name": "Extract Message Data",
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
460,
300
]
},
{
"parameters": {
"resource": "chat",
"operation": "message",
"model": "gpt-4o",
"messages": {
"values": [
{
"role": "system",
"content": "You are a content moderation AI. Analyze the following message for violations including: hate speech, harassment, spam, NSFW content, scam links, excessive caps/emojis. Respond with a JSON object: {\"violation\": true/false, \"category\": \"string or null\", \"severity\": \"low/medium/high or null\", \"reason\": \"brief explanation\"}. Only output the JSON, nothing else."
},
{
"role": "user",
"content": "={{ $json.messageContent }}"
}
]
},
"options": {
"temperature": 0.1,
"maxTokens": 200,
"response_format": {
"type": "json_object"
}
}
},
"id": "c3d4e5f6-3333-4000-8000-000000000003",
"name": "OpenAI Moderate",
"type": "@n8n/n8n-nodes-langchain.openAi",
"typeVersion": 1.6,
"position": [
680,
300
],
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"id": "check-violation",
"leftValue": "={{ JSON.parse($json.message.content).violation }}",
"rightValue": true,
"operator": {
"type": "boolean",
"operation": "equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"id": "c3d4e5f6-3333-4000-8000-000000000004",
"name": "IF Violation Detected",
"type": "n8n-nodes-base.if",
"typeVersion": 2.1,
"position": [
900,
300
]
},
{
"parameters": {
"method": "DELETE",
"url": "=https://discord.com/api/v10/channels/{{ $('Extract Message Data').item.json.channelId }}/messages/{{ $('Extract Message Data').item.json.messageId }}",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"options": {}
},
"id": "c3d4e5f6-3333-4000-8000-000000000005",
"name": "Delete Violating Message",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1120,
200
],
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"method": "POST",
"url": "=https://discord.com/api/v10/channels/{{ $('Extract Message Data').item.json.channelId }}/messages",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "content",
"value": "=\u26a0\ufe0f <@{{ $('Extract Message Data').item.json.authorId }}> Your message was removed for violating server rules ({{ JSON.parse($('OpenAI Moderate').item.json.message.content).category }}). Please review the community guidelines."
}
]
},
"options": {}
},
"id": "c3d4e5f6-3333-4000-8000-000000000006",
"name": "Send Warning",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1340,
200
],
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
}
}
],
"connections": {
"Discord Trigger": {
"main": [
[
{
"node": "Extract Message Data",
"type": "main",
"index": 0
}
]
]
},
"Extract Message Data": {
"main": [
[
{
"node": "OpenAI Moderate",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Moderate": {
"main": [
[
{
"node": "IF Violation Detected",
"type": "main",
"index": 0
}
]
]
},
"IF Violation Detected": {
"main": [
[
{
"node": "Delete Violating Message",
"type": "main",
"index": 0
}
],
[]
]
},
"Delete Violating Message": {
"main": [
[
{
"node": "Send Warning",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
},
"staticData": null
}
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.
discordBotApihttpHeaderAuthopenAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Discord AI Moderator Bot. Uses discord, openAi, httpRequest. Manual trigger; 6 nodes.
Source: https://github.com/mlnjsh/n8n-workflows-mega/blob/main/workflows/ai-chatbots/03-discord-ai-moderator.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
AI-Powered Short-Form Video Generator with OpenAI, Flux, Kling, and ElevenLabs and upload to all social networks. Uses httpRequest, openAi, stickyNote, googleDrive. Scheduled trigger; 51 nodes.
AI Automated TikTok/Youtube Shorts/Reels Generator. Uses httpRequest, openAi, stickyNote, googleDrive. Scheduled trigger; 41 nodes.
Bannerbear Discord. Uses formTrigger, httpRequest, bannerbear, stickyNote. Event-driven trigger; 16 nodes.
Bannerbear Discord. Uses formTrigger, httpRequest, bannerbear, stickyNote. Event-driven trigger; 16 nodes.
Auto-create and publish AI social videos with Telegram, GPT-4 and Blotato. Uses httpRequest, stickyNote, telegramTrigger, telegram. Event-driven trigger; 42 nodes.