Anti-Ban Protection
Starting with UDMODZ Edition v6.1.3, every socket created via makeWASocket is automatically wrapped with baileys-antiban — a full-featured anti-ban middleware layer.
No extra code needed. It just works.
How It Works
When you call makeWASocket(config), the returned socket is transparently proxied through the anti-ban middleware unless you opt out. Every sendMessage call is:
- Rate-limited with Gaussian jitter (human-like timing, not a fixed interval)
- Warmed up gradually on a fresh session (no sudden burst from cold start)
- Health-monitored for bad MAC counts, disconnection patterns, and ban risk signals
Default Usage (Recommended)
No config needed. Antiban is on by default:
import makeWASocket, { useMultiFileAuthState } from 'amiudmodz'
import P from 'pino'
const { state, saveCreds } = await useMultiFileAuthState('auth_info')
const socket = makeWASocket({
logger: P({ level: 'silent' }),
printQRInTerminal: false,
auth: state,
version,
// antiban is enabled automatically — no config required!
})
socket.ev.on('creds.update', saveCreds)
The socket returned has the full Baileys API plus an .antiban property for stats and control.
Checking Anti-Ban Stats
const stats = socket.antiban.getStats()
console.log(stats)
// {
// sendCount: 42,
// rateLimiterStats: { queued: 0, sent: 42 },
// healthStatus: { banRisk: 'low', badMacCount: 0 },
// warmUpState: { isWarmedUp: true, sentSinceStart: 42 }
// }
Disabling Anti-Ban
If you want to manage rate limiting yourself, pass antiban: false:
const socket = makeWASocket({
auth: state,
antiban: false, // opt out — raw socket, no middleware
})
Disabling anti-ban may expose your number to WhatsApp's automated ban systems, especially if you send messages in bulk or on a fresh session.
Custom Anti-Ban Configuration
You can pass any AntiBanConfig options directly:
const socket = makeWASocket({
auth: state,
antiban: {
// Use a named preset as the baseline
preset: 'moderate', // 'conservative' | 'moderate' | 'aggressive' | 'high-volume'
// Fine-tune rate limits
maxPerMinute: 12,
// Warmup options — gradually increase send rate on cold sessions
warmUp: {
enabled: true,
durationMs: 10 * 60 * 1000, // 10-minute warmup
},
}
})
Available Presets
| Preset | Max/Min | Best For |
|---|---|---|
conservative | ~5/min | New numbers, high-risk environments |
moderate (default) | ~15/min | Most personal/small bots |
aggressive | ~30/min | Established numbers, higher volume |
high-volume | ~60/min | Approved business API replacements |
Anti-Ban Features Included
| Feature | Description |
|---|---|
| Gaussian Jitter Rate Limiter | Human-like message timing with randomised delays |
| Warmup Scheduler | Gradually ramps send rate on fresh/reconnected sessions |
| Session Health Monitor | Tracks bad MACs, disconnects, and ban risk level |
| Deaf Session Detector | Detects dead WebSocket connections that still ping-pong |
| Legitimacy Signal Injection | Optional: simulated read gaps, typing pauses |
| Group Operation Guard | Rate-limits group add/remove/create to prevent spam flags |
| JID Circuit Breaker | Blocks sends to problematic recipients after threshold failures |
| Post-Reconnect Throttle | Slows down messages after a reconnect to avoid burst detection |
| Reply Ratio Guard | Tracks incoming vs outgoing ratio and warns on spam-like patterns |
Note: Poll vote helper and channel auto-follow features from
baileys-antibanare not enabled in this integration (as per UDMODZ policy).
Advanced: Accessing the AntiBan Controller Directly
// Get the full AntiBan controller
const antiban = socket.antiban
// Pause sending (e.g., before a risky operation)
antiban.pause()
// Resume
antiban.resume()
// Get current health status
const health = antiban.health.getStatus()
console.log(health.banRisk) // 'low' | 'medium' | 'high' | 'critical'
// Get rate limiter stats
const rl = antiban.rateLimiter.getStats()
console.log(rl.queued) // messages queued waiting to send