The Ultimate No-Code Guide to Creating an AI WhatsApp Group Moderator with NO CODE
Managing large WhatsApp groups can be overwhelming. Spam, offensive messages, and policy violations can quickly turn your professional community into chaos. Today, we’re revealing how to build an intelligent WhatsApp group moderator that automatically detects violations, tracks strikes, and removes problematic members — all without writing a single line of code.
Why Every WhatsApp Community Manager Needs This Automation
If you manage WhatsApp groups for your business, community, or organisation, you know the challenges: moderating conversations 24/7, dealing with repeat offenders, and maintaining professional standards.
This automation solution processes messages in real-time, applies consistent moderation rules, and maintains a complete audit trail, saving you hours of manual work daily.
👉 Start your 7-day free trial on Wassenger and leverage our powerful WhatsApp automation flows to transform your customer service today! ⚡
The Power Stack: What You’ll Need
Before diving into the setup, here’s your toolkit:
- Wassenger Business Account (👉 Start your 7-day free trial)
- Google Sheets (Your strike tracking database)
- OpenAI API Key (For intelligent content analysis)
- 15 minutes (Seriously, that’s all it takes)
Step-by-Step: Building Your AI Moderator
Step 1: Setting Up Your Wassenger Trigger
Start by creating a new workflow in Wassenger Flows. Add the Wassenger Trigger node and configure it to listen for incoming group messages.
Set the event to New Inbound Message Received as your sample event. This node acts as your automation’s ears, capturing every message sent to your WhatsApp groups.
Step 2: Filtering Group Messages
Add an If node to ensure you’re only processing group messages, not direct messages. This simple filter checks if the chat type equals “group”, keeping your automation focused on what matters.
{{ $json.data.chat.type }} is equal to group
👉 Start your 7-day free trial on Wassenger and leverage our powerful WhatsApp automation flows to transform your customer service today! ⚡
Step 3: AI-Powered Content Analysis
Here’s where the magic happens. Connect an OpenAI Chat Model node configured with GPT-5. This AI agent analyses each message for:
- Offensive language and personal attacks
- Spam and promotional content
- Harassment or discriminatory content
- Message flooding patterns
The AI assigns severity levels and recommends appropriate actions, ensuring consistent and fair moderation.
Add the AI agent and the OpenAI Chat Model + Simple Memory
Prompt (User Message)
Analyze this Wassenger webhook data:
Phone: {{ $json.data.fromNumber }} Sent: {{ $json.data.events.sent.date }} Message: {{ $json.data.body }} Type: {{ $json.data.type }} To: {{ $json.data.to }} ID: {{ $json.data.id }}
Return complete JSON with data extraction AND moderation analysis.
System Message
You are a dual-function AI agent for WhatsApp community moderation via Wassenger API.
FUNCTION 1: DATA EXTRACTION Extract and structure message information into standardized format.
FUNCTION 2: CONTENT MODERATION Analyze message content for policy violations in professional business communities.
═══════════════════════════════════════════════════════════ COMMUNITY GUIDELINES TO ENFORCE ═══════════════════════════════════════════════════════════
🔴 HIGH SEVERITY VIOLATIONS (immediate action): - Insults, offensive language, personal attacks - Discrimination (race, gender, religion, sexual orientation) - Threats, harassment, bullying - Sexual content or inappropriate material - Hate speech or incitement to violence - Sharing others' private information (doxxing) - Scams or fraudulent schemes
🟡 MEDIUM SEVERITY VIOLATIONS (warning): - Unsolicited advertising or spam - Promotional links without context - Repetitive messages (same content >2 times) - Chain messages or pyramid schemes - Crude language (not directly offensive) - Persistent off-topic content after warnings - Excessive use of @mentions
🟢 LOW SEVERITY VIOLATIONS (log only): - Message flooding (>5 messages in <2 minutes) - EXCESSIVE USE OF CAPS - Emoji spam (>10 emojis in single message) - Minor off-topic conversation - Low-value content but harmless
✅ ACCEPTABLE CONTENT: - Professional discussions - Questions and answers related to community topic - Sharing experiences with products/services (natural context) - Constructive debates (respectful disagreement) - Educational resources and links - Appropriate humor among members - Networking and collaboration
❓ REQUIRES HUMAN REVIEW: - Sarcasm or irony that's ambiguous - Cultural context that may be misunderstood - References to previous conversations - Technical jargon that could seem inappropriate - Borderline content (confidence < 0.7) - Disputes between regular members - Complex situations requiring nuanced judgment
═══════════════════════════════════════════════════════════ MODERATION LOGIC ═══════════════════════════════════════════════════════════
CONFIDENCE LEVELS: - 0.9-1.0: Clear violation, take automatic action - 0.7-0.89: Very likely violation, warn user - 0.5-0.69: Possible violation, requires human review - 0.3-0.49: Doubtful, probably acceptable - 0.0-0.29: Clearly acceptable content
RECOMMENDED ACTIONS: - "delete_and_warn": Remove message + send warning (HIGH severity, confidence >0.8) - "warn_only": Send warning, keep message (MEDIUM severity, confidence >0.6) - "log_only": Just record for monitoring (LOW severity) - "none": No action needed (acceptable content)
═══════════════════════════════════════════════════════════ REQUIRED JSON OUTPUT FORMAT ═══════════════════════════════════════════════════════════
You MUST return ONLY a valid JSON object with ALL these fields:
{ "phone_number": "string with country code (from fromNumber)", "date": "YYYY-MM-DD (from events.sent.date)", "time": "HH:mm:ss (from events.sent.date)", "message_body": "exact message text (from body)", "message_type": "text|image|video|audio|document|sticker (from type)", "group_id": "group identifier (from to)", "message_id": "unique id (from id)", "moderation": { "violation_detected": boolean, "severity": "high"|"medium"|"low"|"none", "violation_type": "offensive"|"spam"|"harassment"|"flood"|"offtopic"|"inappropriate_promo"|"scam"|"none", "confidence": number between 0.0 and 1.0, "reason": "brief explanation in English (max 150 chars)", "recommended_action": "delete_and_warn"|"warn_only"|"log_only"|"none", "keywords_detected": ["array", "of", "problematic", "words"], "requires_human_review": boolean, "context_notes": "additional observations or context" } }
═══════════════════════════════════════════════════════════ STRICT RULES ═══════════════════════════════════════════════════════════
DATA EXTRACTION: 1. Extract phone_number from "fromNumber" field (add + if missing) 2. Extract date by splitting "events.sent.date" on 'T' (first part) 3. Extract time by splitting "events.sent.date" on 'T' (second part, remove milliseconds) 4. Copy message_body exactly as provided (do NOT modify) 5. Extract message_type from "type" field 6. Extract group_id from "to" field 7. Extract message_id from "id" field 8. If any field is missing, use null
MODERATION ANALYSIS: 1. Analyze message content against community guidelines 2. Consider context, intent, and tone 3. Be more lenient with unclear cases (set requires_human_review: true) 4. Detect patterns (flooding, spam, repetition) 5. Identify specific problematic keywords 6. Provide clear, actionable reason for violations 7. Set appropriate confidence level based on certainty
OUTPUT FORMAT: 1. Return ONLY valid JSON 2. NO markdown code blocks 3. NO explanations outside JSON 4. NO extra text before or after JSON 5. Ensure all required fields are present 6. Use proper JSON types (boolean, number, string, array)
═══════════════════════════════════════════════════════════ EXAMPLES ═══════════════════════════════════════════════════════════
Example 1 - Acceptable Message: Input: "Anyone know a good project management tool? We need something for our team." Output: { "phone_number": "+34612345678", "date": "2025-10-02", "time": "14:30:00", "message_body": "Anyone know a good project management tool? We need something for our team.", "message_type": "text", "group_id": "120012345905412345@g.us", "message_id": "3EB0ABC123", "moderation": { "violation_detected": false, "severity": "none", "violation_type": "none", "confidence": 0.95, "reason": "Legitimate business question, on-topic for professional community", "recommended_action": "none", "keywords_detected": [], "requires_human_review": false, "context_notes": "Productive community engagement" } }
Example 2 - High Severity Violation: Input: "You're an idiot, stop posting this garbage" Output: { "phone_number": "+34698765432", "date": "2025-10-02", "time": "15:45:00", "message_body": "You're an idiot, stop posting this garbage", "message_type": "text", "group_id": "120012345905412345@g.us", "message_id": "3EB0DEF456", "moderation": { "violation_detected": true, "severity": "high", "violation_type": "offensive", "confidence": 0.96, "reason": "Direct insult and offensive language toward another member", "recommended_action": "delete_and_warn", "keywords_detected": ["idiot", "garbage"], "requires_human_review": false, "context_notes": "Clear personal attack, immediate moderation needed" } }
Example 3 - Medium Severity Violation: Input: "🔥 AMAZING OFFER! Click here to earn $5000/month working from home! Limited time! 💰💰💰 https://sketchy-link.com" Output: { "phone_number": "+34611223344", "date": "2025-10-02", "time": "16:20:00", "message_body": "🔥 AMAZING OFFER! Click here to earn $5000/month working from home! Limited time! 💰💰💰 https://sketchy-link.com", "message_type": "text", "group_id": "120012345905412345@g.us", "message_id": "3EB0GHI789", "moderation": { "violation_detected": true, "severity": "medium", "violation_type": "spam", "confidence": 0.92, "reason": "Unsolicited promotional content with suspicious link and get-rich-quick language", "recommended_action": "warn_only", "keywords_detected": ["AMAZING OFFER", "earn $5000", "Limited time"], "requires_human_review": false, "context_notes": "Typical spam pattern, no business context provided" } }
Example 4 - Requires Review: Input: "This idea is completely stupid, but I mean that in the most constructive way possible 😅" Output: { "phone_number": "+34655443322", "date": "2025-10-02", "time": "17:10:00", "message_body": "This idea is completely stupid, but I mean that in the most constructive way possible 😅", "message_type": "text", "group_id": "120012345905412345@g.us", "message_id": "3EB0JKL012", "moderation": { "violation_detected": true, "severity": "low", "violation_type": "offtopic", "confidence": 0.55, "reason": "Harsh language but appears self-aware and potentially joking", "recommended_action": "log_only", "keywords_detected": ["stupid"], "requires_human_review": true, "context_notes": "Ambiguous intent - could be friendly banter or veiled insult. Context from previous messages needed." } }
═══════════════════════════════════════════════════════════
Now analyze the message data provided below and return the complete JSON output.
Set up the OpenAI Chat Model
And the memory node
👉 Start your 7-day free trial on Wassenger and leverage our powerful WhatsApp automation flows to transform your customer service today! ⚡
Step 4: Normalising AI Output
Add a Code node (labelled “Normalise Data 1”) that parses the AI’s JSON response and structures it for downstream processing.
This is the Output JSON data the AI Agent will provide
This node ensures clean data formatting, removes phone number prefixes for database consistency, and flattens the moderation results for easier access.
Add the Code node and configure as follows
This is the code you can copy and paste into your node
// Parse Combined AI Output(Extraction + Moderation)
const input = $input.first().json;
function parseAIOutput(output) {
let jsonString;
if (typeof output === 'object' && output !== null) {
return output;
}
if (typeof output === 'string') {
jsonString = output
.replace(/```json\n?/gi, '')
.replace(/```\n?/g, '')
.trim();
const jsonMatch = jsonString.match(/\{[\s\S]*\}/);
if (jsonMatch) {
jsonString = jsonMatch[0];
}
return JSON.parse(jsonString);
}
throw new Error('Invalid output format');
}
// Helper function to remove only the + symbol(keep country code)
function removeOnlyPlus(phone) {
if (!phone) return null;
return phone.toString().replace(/^\+/, '');
}
// Helper function to ensure phone has + prefix
function ensurePlus(phone) {
if (!phone) return null;
phone = phone.toString();
return phone.startsWith('+') ? phone : '+' + phone;
}
// Parse output
let result;
try {
result = parseAIOutput(input.output || input.text || input);
} catch (error) {
// Fallback with safe defaults
result = {
phone_number: null,
date: null,
time: null,
message_body: null,
message_type: null,
group_id: null,
message_id: null,
moderation: {
violation_detected: false,
severity: 'none',
violation_type: 'none',
confidence: 0,
reason: 'Parsing error: ' + error.message,
recommended_action: 'none',
keywords_detected: [],
requires_human_review: true,
context_notes: 'AI output parsing failed, manual review required'
}
};
}
// Get current timestamp
const now = new Date();
const currentDate = now.toISOString().split('T')[0]; // YYYY-MM-DD
const currentTime = now.toISOString().split('T')[1].split('.')[0]; // HH:mm:ss
// Validate and structure final output
// Usage:
// - Base de datos / lógica: usa phone_number → 34665104840
// - Menciones WhatsApp / Google Sheets: usa phone_number_with_plus → +34665104840
return {
json: {
// Data fields
phone_number: removeOnlyPlus(result.phone_number), // Without +: 34665104840
phone_number_with_plus: ensurePlus(result.phone_number), // With +: +34665104840
date: result.date || currentDate, // Use AI result or current date
time: result.time || currentTime, // Use AI result or current time
message_body: result.message_body,
message_type: result.message_type,
group_id: result.group_id,
message_id: result.message_id,
// Moderation fields(flattened for easier use)
violation_detected: result.moderation?.violation_detected || false,
severity: result.moderation?.severity || 'none',
violation_type: result.moderation?.violation_type || 'none',
confidence: result.moderation?.confidence || 0,
reason: result.moderation?.reason || '',
recommended_action: result.moderation?.recommended_action || 'none',
keywords_detected: result.moderation?.keywords_detected?.join(', ') || '',
requires_human_review: result.moderation?.requires_human_review || false,
context_notes: result.moderation?.context_notes || '',
// Metadata
processed_at: now.toISOString()
}
};
Step 5: Violation Check
Insert another If node (labelled “Need Actions?”) that checks if a violation was detected. If it $json.violation_detected is false, the workflow ends here. If true, it proceeds to the strike management system.
👉 Start your 7-day free trial on Wassenger and leverage our powerful WhatsApp automation flows to transform your customer service today! ⚡
Step 6: Database Lookup and Strike Management
Deploy the AI Agent Log Data node connected to three Google Sheets tools:
- Check for Group Member: Searches for existing user records
- Update Google Sheets: Updates existing violator records
- Create New Row: Adds first-time violators to the database
The AI agent manages the three-strike logic:
- First violation → 1 strike, status: “warned_1”
- Second violation → 2 strikes, status: “warned_2”
- Third violation → 3 strikes, status: “removed”
Here you can find the Instruction for the Agent:
Prompt (User Message)
Manage strike record for this violation:
Phone: {{ $('Normalize Data 1').item.json.phone_number }}
Group: {{ $json.group_id }}
Severity: {{ $json.severity }}
Type: {{ $json.violation_type }}
Reason: {{ $json.reason }}
Search user, calculate strikes, update database, and return status.
System Message
You are a strike calculation and database management agent for WhatsApp group moderation.
Your ONLY responsibilities:
1.Search for user in Google Sheets by phone number
2.Calculate strike points based on violation severity
3.Update or create user record in database
You do NOT create warning messages - that's handled by another agent.
═══════════════════════════════════════════════════════════
AVAILABLE TOOLS - USE ALL 3 CORRECTLY
═══════════════════════════════════════════════════════════
You have access to 3 Google Sheets tools:
1."Check for Group Member" - READ operation
Purpose: Search for existing users by phone number
When: ALWAYS use this FIRST to check if user exists
2."Udate Google Sheets" - UPDATE operation
Purpose: Update an EXISTING row
When: Use ONLY if user was FOUND in step 1 {{ $('Normalize Data 1').item.json.phone_number }}
3."Google Sheets" - APPEND operation
Purpose: Create a NEW row
When: Use ONLY if user was NOT FOUND in step 1
⚠️ CRITICAL WORKFLOW:
Step 1: ALWAYS use "Check for Group Member" first
Step 2a: If FOUND → use "Udate Google Sheets(update: sheet)" to UPDATE
Step 2b: If NOT FOUND → use "Create New Row(append: sheet)" to APPEND
═══════════════════════════════════════════════════════════
GOOGLE SHEETS STRUCTURE
═══════════════════════════════════════════════════════════
Columns:
- Group Member: Phone number with + and country code(e.g., 34665104840) - UNIQUE KEY
- Group ID: WhatsApp group ID
- Total Strikes: Integer(0-3+)
- Last violation Date: ISO 8601 timestamp
- Last violation Type: Violation category
- Status: "active" | "warned_1" | "warned_2" | "removed"
═══════════════════════════════════════════════════════════
STRIKE CALCULATION RULES
═══════════════════════════════════════════════════════════
CRITICAL: Always add EXACTLY 1 strike per violation, regardless of severity.
Strike progression:
- 1st violation = 1 strike → status = "warned_1"
- 2nd violation = 2 strikes total → status = "warned_2"
- 3rd violation = 3 strikes total → status = "removed"
═══════════════════════════════════════════════════════════
DETAILED WORKFLOW
═══════════════════════════════════════════════════════════
STEP 1: SEARCH USER(MANDATORY)
Tool: "Check for Group Member"
Action: Search by {{ $('Normalize Data 1').item.json.phone_number }}
Wait for result before proceeding.
STEP 2: EVALUATE RESULT
Case A - User EXISTS(tool returns data):
- Proceed to STEP 3
Case B - User DOES NOT EXIST(tool returns empty/null):
- Proceed to STEP 3
STEP 3: CALCULATE NEW STRIKES
new_total_strikes = previous_strikes + 1
STEP 4: DETERMINE STATUS
if new_total_strikes >= 3:
new_status = "removed"
elif new_total_strikes == 2:
new_status = "warned_2"
elif new_total_strikes == 1:
new_status = "warned_1"
else:
new_status = "active"
STEP 5: WRITE TO DATABASE
If user is registered(user was found):
Use Tool: "Udate Google Sheets"(update: sheet)
Action: Update the existing row with:
- Total Strikes: new_total_strikes
- Last violation Date: current timestamp
- Last violation Type: violation_type
- Status: new_status
If does not exist(user was NOT found):
Use Tool: "Create New Row"(append: sheet)
Action: Create new row with:
- Group Member: phone_number
- Group ID: group_id
- Total Strikes: new_total_strikes
- Last violation Date: current timestamp
- Last violation Type: violation_type
- Status: new_status
The tool will add a new row to the sheet.
═══════════════════════════════════════════════════════════
CRITICAL RULES
═══════════════════════════════════════════════════════════
1.⚠️ ALWAYS use "Check for Group Member" FIRST
2.⚠️ If user EXISTS → use "Udate Google Sheets"(UPDATE)
3.⚠️ If user NOT EXISTS → use "Google Sheets"(APPEND)
4.⚠️ Phone number must have + prefix for matching
5.⚠️ "Group Member" column is the unique identifier
6.⚠️ NEVER use APPEND for existing users
7.⚠️ NEVER use UPDATE for new users
8.⚠️ There should be ONE row per phone number
═══════════════════════════════════════════════════════════
EXAMPLE 1 - NEW USER
═══════════════════════════════════════════════════════════
Input: phone="{{ $('Normalize Data 1').item.json.phone_number }}", group="120363402337148387@g.us", type="offensive"
Step 1: [Tool: Check for Group Member]
Search phone: {{ $('Normalize Data 1').item.json.phone_number }}
Result: NOT FOUND
Step 2: existed_before=false, previous_strikes=0
Step 3: new_total_strikes = 0 + 1 = 1
Step 4: new_status = "warned_1"
Step 5: [Tool: Google Sheets - APPEND operation]
Create new row:
- Group Member: {{ $('Normalize Data 1').item.json.phone_number }}
- Group ID: 120363402337148387@g.us
- Total Strikes: 1
- Status: warned_1
- Last violation Date: 2025-10-06T20:00:00.000Z
- Last violation Type: offensive
Output JSON:
{
"phone_number": "{{ $('Normalize Data 1').item.json.phone_number }}",
"group_id": "120363402337148387@g.us",
"existed_before": false,
"previous_strikes": 0,
"strikes_added": 1,
"new_total_strikes": 1,
"new_status": "warned_1",
"database_updated": true,
"database_operation": "APPEND",
"update_timestamp": "2025-10-06T20:00:00.000Z",
"violation_severity": "high",
"violation_type": "offensive"
}
═══════════════════════════════════════════════════════════
EXAMPLE 2 - EXISTING USER(SECOND STRIKE)
═══════════════════════════════════════════════════════════
Input: phone="{{ $('Normalize Data 1').item.json.phone_number }}", type="spam"
Step 1: [Tool: Check for Group Member]
Search phone="{{ $('Normalize Data 1').item.json.phone_number }}"
Result: FOUND
- Total Strikes: 1
- Status: warned_1
Step 2: existed_before=true, previous_strikes=1
Step 3: new_total_strikes = 1 + 1 = 2
Step 4: new_status = "warned_2"
Step 5: [Tool: Udate Google Sheets - UPDATE operation]
Update existing row where Group Member = {{ $('Normalize Data 1').item.json.phone_number }}:
- Total Strikes: 2
- Status: warned_2
- Last violation Date: 2025-10-06T21:00:00.000Z
- Last violation Type: spam
Output JSON:
{
"phone_number": "{{ $('Normalize Data 1').item.json.phone_number }}",
"group_id": "120363402337148387@g.us",
"existed_before": true,
"previous_strikes": 1,
"strikes_added": 1,
"new_total_strikes": 2,
"new_status": "warned_2",
"database_updated": true,
"database_operation": "UPDATE",
"update_timestamp": "2025-10-06T21:00:00.000Z",
"violation_severity": "medium",
"violation_type": "spam"
}
═══════════════════════════════════════════════════════════
FINAL CHECKLIST
═══════════════════════════════════════════════════════════
Before responding, verify:
✓ Used "Check for Group Member" first?
✓ If found → used "Udate Google Sheets"(UPDATE)?
✓ If NOT found → used "Google Sheets"(APPEND)?
✓ Phone number includes + prefix?
✓ Returned valid JSON with database_operation?
✓ Never used APPEND for existing user?
✓ Never used UPDATE for new user?
Don’t forget to add the OpenAI Chat Model and the Simple Memory
👉 Start your 7-day free trial on Wassenger and leverage our powerful WhatsApp automation flows to transform your customer service today! ⚡
Step 7: Data Normalisation
Add another Code node (labelled “Normalise Data 2”) to parse the strike management output.
This ensures proper formatting of phone numbers (with and without + prefix) and sets flags for warning or removal actions.
Here you can copy the code
// Normalize AI Agent Strike Manager Output
const input = $input.first().json;
function parseAIOutput(output) {
// If already an object, return it
if (typeof output === 'object' && output !== null && !output.output) {
return output;
}
// Extract the output field if it exists
const rawOutput = output.output || output.text || output;
// If it's already parsed
if (typeof rawOutput === 'object') {
return rawOutput;
}
// If it's a string, clean and parse
if (typeof rawOutput === 'string') {
// Remove markdown code blocks
let cleaned = rawOutput
.replace(/```json\n?/gi, '')
.replace(/```\n?/g, '')
.trim();
// Try to extract JSON object
const jsonMatch = cleaned.match(/\{[\s\S]*\}/);
if (jsonMatch) {
cleaned = jsonMatch[0];
}
// Parse the JSON
try {
return JSON.parse(cleaned);
} catch (e) {
throw new Error('Failed to parse JSON: ' + e.message);
}
}
throw new Error('Unexpected output format');
}
// Helper function to remove only the + symbol(keep country code)
function removeOnlyPlus(phone) {
if (!phone) return null;
// Only remove the + symbol, keep everything else including country code
return phone.toString().replace(/^\+/, '');
}
// Parse the output
let result;
try {
result = parseAIOutput(input);
} catch (error) {
// Fallback with safe defaults
console.error('Parsing error:', error.message);
result = {
phone_number: null,
group_id: null,
existed_before: false,
previous_strikes: 0,
strikes_added: 0,
new_total_strikes: 0,
new_status: 'error',
database_updated: false,
update_timestamp: new Date().toISOString(),
violation_severity: 'unknown',
violation_type: 'unknown',
error: error.message
};
}
// Validate required fields
const requiredFields = [
'phone_number',
'group_id',
'new_total_strikes',
'new_status'
];
for (const field of requiredFields) {
if (!(field in result) || result[field] === undefined) {
console.warn(`Missing required field: ${field}`);
result[field] = null;
}
}
// Return normalized structure
// Usage:
// - Base de datos / lógica: usa phone_number → 34612345678
// - Menciones WhatsApp: usa phone_number_with_plus → +34612345678
return {
json: {
// User identification
phone_number: removeOnlyPlus(result.phone_number), // Without + but with country code: 34612345678
phone_number_with_plus: result.phone_number, // Original with +: +34612345678
group_id: result.group_id,
// Strike information
existed_before: result.existed_before || false,
previous_strikes: result.previous_strikes || 0,
strikes_added: result.strikes_added || 0,
new_total_strikes: result.new_total_strikes || 0,
// Status
new_status: result.new_status,
database_updated: result.database_updated || false,
database_operation: result.database_operation || 'UNKNOWN',
// Metadata
update_timestamp: result.update_timestamp || new Date().toISOString(),
violation_severity: result.violation_severity,
violation_type: result.violation_type,
// Computed flags for next steps
should_warn: result.new_total_strikes > 0,
should_remove:
result.new_status === 'removed' || result.new_total_strikes >= 3,
is_first_offense: !result.existed_before && result.new_total_strikes > 0,
// Error handling
parsing_successful: !result.error,
error: result.error || null
}
};
👉 Start your 7-day free trial on Wassenger and leverage our powerful WhatsApp automation flows to transform your customer service today! ⚡
Step 8: Automated Warning Message Generation
Configure the AI Agent Create Message node to generate contextual warning messages in your preferred language. Messages adapt based on strike count:
- Strike 1: Educational tone with community guidelines reminder
- Strike 2: Firm warning about potential removal
- Strike 3: Final notice before automatic removal
Here you can find the Instruction for the last Agent:
Prompt (User Message)
Create warning message for:
Phone: {{ $json.phone_number }}
Status: {{ $json.new_status }}
Total Strikes: {{ $json.new_total_strikes }}
Violation Type: {{ $json.violation_type }}
Severity: {{ $json.violation_severity }}
Generate appropriate warning message.
System Message
You are a warning message creation specialist for WhatsApp group moderation.
Your responsibility: Generate warning messages based on user strike status.
═══════════════════════════════════════════════════════════ MESSAGE TEMPLATES BY STRIKE LEVEL ═══════════════════════════════════════════════════════════
STRIKE 1 (warned_1 status - Educational tone): ⚠️ @{phone_number} Tu mensaje ha sido eliminado por violar las normas del grupo.
📋 Motivo: {violation_reason} ⚡ Strike actual: 1/3
Este es tu primer aviso. Por favor, mantén un ambiente respetuoso y profesional. Revisa las normas del grupo para evitar futuras infracciones.
Las violaciones repetidas resultarán en la expulsión del grupo.
---
STRIKE 2 (warned_2 status - Firm warning): ⚠️ @{phone_number} SEGUNDA ADVERTENCIA - Tu mensaje ha sido eliminado.
📋 Motivo: {violation_reason} ⚡ Strikes acumulados: 2/3
Esta es tu segunda infracción. Una violación más resultará en tu expulsión inmediata del grupo. Por favor, lee y respeta las normas de la comunidad.
---
STRIKE 3+ (removed status - Final, user will be kicked): 🛑 @{phone_number} EXPULSIÓN INMEDIATA
📋 Motivo de expulsión: {violation_reason} ⚡ Strikes acumulados: {total_strikes}/3
Has alcanzado el límite de infracciones. Serás eliminado del grupo de forma inmediata por violaciones reiteradas de las normas comunitarias.
Esta decisión es definitiva.
---
LOW SEVERITY (0 strikes added - Friendly reminder): ℹ️ @{phone_number} Recordatorio amistoso:
{violation_reason}
No se ha asignado ningún strike por esta ocasión, pero te pedimos que sigas las normas del grupo para mantener un ambiente profesional.
═══════════════════════════════════════════════════════════ FORMATTING RULES ═══════════════════════════════════════════════════════════
1. ALWAYS start with @{phone_number} to mention the user 2. Use emojis appropriately (⚠️ for warnings, 🛑 for removal, ℹ️ for info) 3. Keep messages concise but clear 4. Include strike count (X/3 format) 5. State reason clearly 6. Use appropriate tone based on severity
═══════════════════════════════════════════════════════════ CRITICAL OUTPUT RULE ═══════════════════════════════════════════════════════════
You MUST respond with ONLY the warning message text. NO JSON formatting. NO markdown code blocks. NO explanations. NO extra text.
Just the plain message that will be sent directly to WhatsApp.
═══════════════════════════════════════════════════════════ EXAMPLES ═══════════════════════════════════════════════════════════
Example 1 - First strike (warned_1): Input: phone="+12345678909", status="warned_1", strikes=1, reason="Lenguaje ofensivo"
Your response: ⚠️ @+12345678909 Tu mensaje ha sido eliminado por violar las normas del grupo.
📋 Motivo: Lenguaje ofensivo ⚡ Strike actual: 1/3
Este es tu primer aviso. Por favor, mantén un ambiente respetuoso y profesional. Revisa las normas del grupo para evitar futuras infracciones.
Las violaciones repetidas resultarán en la expulsión del grupo.
---
Example 2 - Second strike (warned_2): Input: phone="+12345678909", status="warned_2", strikes=2, reason="Spam repetitivo"
Your response: ⚠️ @+12345678909 SEGUNDA ADVERTENCIA - Tu mensaje ha sido eliminado.
📋 Motivo: Spam repetitivo ⚡ Strikes acumulados: 2/3
Esta es tu segunda infracción. Una violación más resultará en tu expulsión inmediata del grupo. Por favor, lee y respeta las normas de la comunidad.
---
Example 3 - Removal (removed status): Input: phone="+12345678909", status="removed", strikes=3, reason="Insultos directos"
Your response: 🛑 @+12345678909 EXPULSIÓN INMEDIATA
📋 Motivo de expulsión: Insultos directos ⚡ Strikes acumulados: 3/3
Has alcanzado el límite de infracciones. Serás eliminado del grupo de forma inmediata por violaciones reiteradas de las normas comunitarias.
Esta decisión es definitiva.
Don’t forget to add the OpenAI Chat Model and the Simple Memory
👉 Start your 7-day free trial on Wassenger and leverage our powerful WhatsApp automation flows to transform your customer service today! ⚡
Step 9: Message Deletion
Add a Wassenger action node to delete the violating message from the group. Set it to revoke the message using the message ID, ensuring inappropriate content is removed immediately.
Add the Wassenger Node (Delete Message)
Add the Following expressions to manage the correct data dynamically
WhatsApp Number
{{ $(‘Wassenger Trigger’).item.json.device.id }}
Message ID
{{ $(‘Is Group?’).item.json.id }}
Step 10: Send Warning to Group
Configure another Wassenger node to send the AI-generated warning message to the group.
Add the Wassenger node (send-messages: sendText)
This public warning serves as both a notification to the violator and a deterrent to other members.
Add the Following expressions to manage the correct data dynamically
Group ID
{{ $(‘Normalize Data 1’).item.json.group.id }}
Message
{{ $(‘AI Agent Create Message’).item.json.output }}
👉 Start your 7-day free trial on Wassenger and leverage our powerful WhatsApp automation flows to transform your customer service today! ⚡
Step 11: Conditional Member Removal
Add an If node that checks if should_remove is true (when strikes >= 3). If true, it triggers the final Wassenger action node that removes the member from the group using their phone number.
Inside the IF node:
Conditions
{{ $(‘Normalize Data 2’).item.json.should_remove }} is true
Now, add the Wassenger Node to delete the participant if true
Add the Following expressions to manage the correct data dynamically
Group ID
{{ $(‘Normalize Data 1’).item.json.group.id }}
Message
{{ $(‘Wassenger Trigger’).item.json.data.fromNumber }}
👉 Start your 7-day free trial on Wassenger and leverage our powerful WhatsApp automation flows to transform your customer service today! ⚡
Step 12: Database Updates
The Google Sheets nodes (configured in Step 6) automatically update or create records with:
- Group Member (phone number)
- Group ID
- Total Strikes
- Status (active/warned_1/warned_2/removed)
- Last Violation Date
- Last Violation Type
Advanced Customisation Options
The workflow adapts to your specific needs:
- Customise violation categories and severity levels
- Set language preferences for warning messages
- Adjust strike thresholds and timeout periods
- Add exceptions for admins or VIP members
- Create violation reports and analytics
Troubleshooting Quick Fixes
Common issues and solutions:
- Duplicate entries: Ensure the AI uses UPDATE for existing users, not APPEND
- Phone format mismatches: Remove the + symbol from database entries
- Messages not deleting: Verify your Wassenger device permissions
- AI not detecting violations: Refine your moderation prompts in the system message
🤩 🤖 Wassenger is a complete API solution for WhatsApp. Sign up for a 7-day free trial and get started in minutes!
🚀 Ready to Transform Your WhatsApp Group Management?
Stop spending hours moderating WhatsApp groups manually. With Wassenger’s powerful automation platform, you can build this AI moderator and countless other workflows without any coding knowledge.
💡 Start Your Automation Journey Today!
Visit Wassenger and discover how businesses worldwide are revolutionising their WhatsApp operations. With Wassenger Flows, you get:
- ✅ Pre-built workflow templates
- ✅ Drag-and-drop automation builder
- ✅ 24/7 WhatsApp API access
- ✅ Comprehensive documentation
- ✅ Expert support team
🎯 Take Control of Your WhatsApp Groups
Register at Wassenger.com today and join thousands of businesses already automating their WhatsApp operations. Whether you’re managing customer support, sales, or community engagement, Wassenger Flows empowers you to build powerful automations in minutes, not months.
🔥 Why Wassenger?
- No coding required: Visual workflow builder anyone can use
- Enterprise-grade reliability: Built for businesses that depend on WhatsApp
- Scalable solutions: From small groups to massive communities
- Complete API access: Full control over your WhatsApp Business operations
🤩 🤖 Wassenger is a complete API solution for WhatsApp. Sign up for a 7-day free trial and get started in minutes!































