npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

Iโ€™ve always been into building performant and accessible sites, but lately Iโ€™ve been taking it extremely seriously. So much so that Iโ€™ve been building a tool to help me optimize and monitor the sites that I build to make sure that Iโ€™m making an attempt to offer the best experience to those who visit them. If youโ€™re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, ๐Ÿ‘‹, Iโ€™m Ryan Hefnerย  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If youโ€™re interested in other things Iโ€™m working on, follow me on Twitter or check out the open source projects Iโ€™ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soonโ€“ish.

Open Software & Tools

This site wouldnโ€™t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you ๐Ÿ™

ยฉ 2026 โ€“ย Pkg Stats / Ryan Hefner

whatsapp-multi-device-client

v1.0.0

Published

๐Ÿš€ Advanced WhatsApp Bot Library with Multi-Device Support & EasyBot API - The most powerful WhatsApp automation library

Readme

๐Ÿš€ WhatsApp Multi Client

NPM Version Downloads License Node.js

The most powerful WhatsApp Bot Library with Multi-Device Support & EasyBot API

๐ŸŽฏ Perfect for beginners AND professionals
๐Ÿ”ง Multi-Device Load Balancing
โšก 3-Line Bot Creation
๐Ÿš€ 120+ Features Built-in


โšก Quick Start (3 Lines!)

import { quickBot } from "whatsapp-multi-client";

quickBot()
    .when("hello").reply("Hi! ๐Ÿ‘‹")
    .start();

That's it! Your WhatsApp bot is running! ๐ŸŽ‰


๐Ÿ“ฆ Installation

npm install whatsapp-multi-client

Requirements:

  • Node.js 16+
  • A WhatsApp account for the bot

๐ŸŽฏ Choose Your API

๐ŸŸข EasyBot - For Beginners

Perfect for quick bots and learning:

import { createBot } from "whatsapp-multi-client";

createBot()
    .when("ping").reply("Pong! ๐Ÿ“")
    .when("hello").reply("Hi there! ๐Ÿ‘‹")
    .command("time", () => new Date().toLocaleString())
    .start();

๐Ÿ”ต Advanced API - For Professionals

Full control and customization:

import { WhatsAppClient } from "whatsapp-multi-client";

const client = new WhatsAppClient();
client.setPrefix('!');

client.on('message', async (msg) => {
    if (msg.text === 'hello') {
        await msg.simulateTyping('Hello! How can I help?');
    }
});

await client.connect();

๐ŸŸก Multi-Device - For Scale

Run multiple WhatsApp accounts simultaneously:

import { MultiWhatsAppClient } from "whatsapp-multi-client";

const multiClient = new MultiWhatsAppClient({
    maxDevices: 3,
    loadBalancing: 'round-robin'
});

await multiClient.addDevice('bot1');
await multiClient.addDevice('bot2');
await multiClient.connect();

// Messages automatically load-balanced across devices!
await multiClient.sendMessage(chatId, { text: 'Hello from multi-device!' });

โšก EasyBot - For Beginners

Super Simple API

Create WhatsApp bots in minutes, not hours!

import { quickBot } from "whatsapp-multi-client";

quickBot()
    .when("hello").reply("Hi! ๐Ÿ‘‹")
    .start();

Action Chaining

Chain multiple actions elegantly:

import { createBot } from "whatsapp-multi-client";

createBot()
    .when("important")
        .react("โš ๏ธ")
        .type(2)
        .reply("This is important!")
        .react("โœ…")
        .done()
    .start();

EasyBot Features

const bot = createBot()
    // Simple responses
    .when("hello").reply("Hi! ๐Ÿ‘‹")
    .when("ping").reply("Pong! ๐Ÿ“")
    
    // Auto-responses
    .autoReply("hi", "Hello!")
    .autoReply("bye", "Goodbye!")
    
    // Commands
    .command("help", "I can help you!")
    .command("time", () => new Date().toLocaleString())
    
    // Templates with variables
    .template("greeting", "Hello {name}! Today is {day}")
    .when("welcome").useTemplate("greeting")
    
    // Conditional logic
    .if("is group").then("reply Hello group!")
    .if("contains bot").then("react ๐Ÿค–")
    
    // Multi-device (optional)
    .enableMultiDevice(2)
    
    .start();

EasyBot Multi-Device

import { multiBot } from "whatsapp-multi-client";

multiBot(3) // 3 devices
    .when("test").reply("Multi-device test!")
    .command("status", "๐Ÿ“Š Multi-device running!")
    .start();

Template System

bot
    .template("info", "Hello {name}! Time: {time}, Date: {date}")
    .template("status", "Chat: {chat} | Day: {day}")
    .when("info").useTemplate("info")
    .when("status").useTemplate("status");

// Available variables:
// {name} - Sender name
// {sender} - Sender JID  
// {time} - Current time
// {date} - Current date
// {datetime} - Date + time
// {day} - Weekday
// {chat} - "Group" or "Private"

๐Ÿ”ฅ Multi-Device Support

Multi-Device System

Run 2-3 WhatsApp accounts simultaneously for higher availability and load balancing!

import { MultiWhatsAppClient } from "whatsapp-multi-client";

const multiClient = new MultiWhatsAppClient({
    maxDevices: 3,
    loadBalancing: 'round-robin' // round-robin, random, least-used, failover
});

// Add devices
await multiClient.addDevice('bot1');
await multiClient.addDevice('bot2'); 
await multiClient.addDevice('bot3');

// Connect all
await multiClient.connect();

Load Balancing Strategies

// Round-robin (default)
multiClient.setLoadBalancingStrategy('round-robin');

// Random selection
multiClient.setLoadBalancingStrategy('random');

// Least used device
multiClient.setLoadBalancingStrategy('least-used');

Smart Messaging

// Load-balanced sending
await multiClient.sendMessage(chatId, { text: 'Hello!' });

// Broadcast to all devices
await multiClient.broadcast(chatId, { text: 'Broadcast!' });

// With failover (if one device fails)
await multiClient.sendWithFailover(chatId, { text: 'Failover!' });

// Specific device
await multiClient.sendFromDevice('bot1', chatId, { text: 'From Bot1!' });

Multi-Device Events

multiClient.on('message', async (msg) => {
    console.log(`Message from device: ${msg.deviceId}`);
    
    // Reply from same device
    await msg.replyFromSameDevice('Same device reply');
    
    // Reply via load balancing
    await msg.replyFromAnyDevice('Load balanced reply');
    
    // Broadcast reply
    await msg.broadcastReply('Broadcast reply');
});

// Device status events
multiClient.on('device.connected', (data) => {
    console.log(`โœ… Device ${data.deviceId} connected`);
});

multiClient.on('device.disconnected', (data) => {
    console.log(`๐Ÿ”ด Device ${data.deviceId} disconnected`);
});

Health Monitoring

// Get status
const status = multiClient.getStatus();
console.log(`${status.activeDevices}/${status.totalDevices} devices active`);

// Health check
const health = multiClient.getHealthCheck();
console.log(`Health: ${health.healthPercentage}% - ${health.recommendation}`);

// Device stats
const stats = multiClient.getDeviceStats();

Multi-Device Benefits:

โœ… Higher availability - If one account gets banned, others continue
โœ… Load distribution - Spread messages across multiple accounts
โœ… Rate limit bypass - WhatsApp limits per account
โœ… Automatic failover - Seamless switching on failures
โœ… Separate auth - Each device has its own authentication


๐Ÿ” Authentication

Persistent Authentication

  • โœ… One-time QR scan โ†’ Always auto-connect
  • โœ… Microsoft Edge integration - QR code in browser
  • โœ… Terminal fallback - QR code in terminal
  • โœ… Auto-reconnect - Automatic reconnection
const client = new WhatsAppClient({
    authDir: "./auth",        // Auth data storage
    printQR: false,          // QR in browser (true = terminal)
    logLevel: "silent"       // Log level
});

๐Ÿ’ฌ Message System

Basic Messaging

// Simple reply
await msg.reply("Hello!")

// With mentions
await msg.reply("Hello @user!", [userJid])

Media Messages

// Images
await msg.sendImage("path/image.jpg", "Caption", [mentions])

// Videos
await msg.sendVideo("path/video.mp4", "Caption", [mentions])

// Audio
await msg.sendAudio("path/audio.mp3")

// Stickers
await msg.sendSticker("path/sticker.webp")

// Documents
await msg.sendDocument("path/file.pdf", "filename.pdf", [mentions])

Special Messages

// Location
await msg.sendLocation(latitude, longitude)

// Contact
await msg.sendContact(vcard, "Display Name")

// Emoji reaction
await msg.react("๐Ÿ˜‚")

// Delete message
await msg.delete()

Message Properties

msg.id          // Message ID
msg.from        // Sender JID
msg.text        // Message text
msg.type        // text, image, video, audio, etc.
msg.isGroup     // true/false
msg.timestamp   // Unix timestamp
msg.raw         // Raw Baileys object

๐ŸŽญ Typing Indicator

Manual Control

// Start/stop typing
await msg.visualWrite(true)           // Typing ON
await msg.visualWrite(false)          // Typing OFF

// Typing for specific time
await msg.typeFor(3000)               // 3 seconds typing

Typing + Reply Combined

// Fixed time
await msg.typeAndReply("Message", 2000)  // 2 seconds typing

// Realistic typing
await msg.simulateTyping("Long text...", {
    typingSpeed: 50,        // ms per character
    minTypingTime: 1000,    // Minimum time
    maxTypingTime: 5000,    // Maximum time
    mentions: [userJid]     // With mentions
})

๐Ÿ‘ฅ Group Management

Group Information

// Group metadata
const metadata = await client.get.GroupMetadata(groupId)

// All participants
const participants = await client.get.GroupParticipants(groupId)

// Only admins
const admins = await client.get.GroupAdmins(groupId)

User Management

// Add user
await client.add.user(groupId, [userJid], [mentions])

// Remove user
await client.kick.user(groupId, [userJid], [mentions])

// Promote to admin
await client.promote.user(groupId, [userJid], [mentions])

// Remove admin
await client.demote.user(groupId, [userJid], [mentions])

Mention System

// Mention single person
await msg.replyWithMention("Hello @user!", userJid)

// Mention all in group
await msg.mentionAll("Hello everyone!")

// Get mentions from message
const mentions = msg.getMentions()

// Check if mentioned
const isMentioned = msg.isMentioned(userJid)

๐Ÿ›ก๏ธ Permission System

Permission Checks

// Admin checks
const isAdmin = await msg.isAdmin()        // Is sender admin?
const isBotAdmin = await msg.isBotAdmin()  // Is bot admin?
const isOwner = await msg.isOwner()        // Is sender owner?

// Chat type checks
const isGroup = msg.isGroup               // Is group?
const isPrivate = msg.isPrivate()         // Is private chat?

// Sender info
const senderJid = msg.getSender()         // Sender JID

Usage in Commands

client.addCommand('kick', async (msg, args) => {
    if (!msg.isGroup) {
        return msg.reply('โŒ Groups only!')
    }
    
    if (!(await msg.isAdmin())) {
        return msg.reply('โŒ Admins only!')
    }
    
    if (!(await msg.isBotAdmin())) {
        return msg.reply('โŒ Bot needs admin rights!')
    }
    
    // Kick logic...
})

๐Ÿ“Š Statistics System

Message Statistics

// Message counts
const stats = await msg.stats.getMessageCount()
// Returns: { total: 1234, today: 56, thisWeek: 234 }

// User activity
const activity = await msg.stats.getUserActivity(userId)
// Returns: { messagesCount: 123, lastSeen: Date, isActive: true }

// Group stats (groups only)
const groupStats = await msg.stats.getGroupStats()
// Returns: { groupName, totalMembers, admins, created, description }

// Top active users
const topUsers = await msg.stats.getMostActiveUsers(5)

// Messages by type
const messageTypes = await msg.stats.getMessagesByType()
// Returns: { text: 500, image: 100, video: 50, ... }

๐ŸŽฏ Command System

Prefix Setup

// Set prefix
const prefix = "!"
client.setPrefix(prefix)

// Register commands
client.addCommand('help', async (msg, args) => {
    await msg.reply('Help text')
})

client.addCommand('ping', async (msg, args) => {
    await msg.reply('Pong! ๐Ÿ“')
})

Command Properties

// In message events
if (msg.isCommand) {
    console.log(msg.command)      // "help"
    console.log(msg.args)         // ["arg1", "arg2"]
    console.log(msg.commandText)  // "help arg1 arg2"
}

Command Management

// List commands
const commands = client.getCommands()

// Remove command
client.removeCommand('help')

// Get prefix
const currentPrefix = client.getPrefix()

๐Ÿ“Š Poll Integration

Create Polls

// Simple poll
await msg.sendPoll('Favorite pizza?', ['Margherita', 'Pepperoni', 'Hawaiian'])

// Multi-selection poll
await msg.sendMultiPoll('Which colors?', ['Red', 'Blue', 'Green'], 2)

Fallback System

If native polls don't work, the library automatically uses emoji fallback:

๐Ÿ“Š **Favorite pizza?**

1๏ธโƒฃ Margherita
2๏ธโƒฃ Pepperoni  
3๏ธโƒฃ Hawaiian

_React with the corresponding emoji!_

๐ŸŽง Event System

Event Registration

// Message events
client.on('message', (msg) => {
    console.log(`Message from ${msg.from}: ${msg.text}`)
})

// Command events
client.on('command', (msg) => {
    console.log(`Command: ${msg.command}`)
})

// Connection events
client.on('connected', () => {
    console.log('Connected!')
})

client.on('disconnected', (data) => {
    console.log('Disconnected:', data.reason)
})

// Group events
client.on('group.participants.update', (update) => {
    console.log('Group changed:', update)
})

// Presence events
client.on('presence.update', (update) => {
    console.log('Status changed:', update)
})

Event Management

// Remove event handler
client.off('message', handler)

// Emit custom event
client.emit('custom-event', data)

๐Ÿ“ฑ QR Code System

QR Code Generation

import { generateQRCode } from "whatsapp-multi-client"

// Generate QR code
await generateQRCode()

// QR code with data
await generateQRCode(qrData)

// Close browser
await closeBrowser()

Features

  • โœ… Microsoft Edge integration - Automatic opening
  • โœ… Terminal fallback - QR in terminal if browser fails
  • โœ… Auto-close - Browser closes automatically after login

๐Ÿ”ง Utility Functions

Connection Management

// Connect
await client.connect()

// Disconnect
await client.disconnect()

// Get status
const state = client.getConnectionState()
// Returns: { isConnected: true, socket: true }

Presence Management

// Global presence
await client.setOnline()
await client.setOffline()
await client.setTyping(chatId)
await client.setRecording(chatId)
await client.setPaused(chatId)

Message Type Detection

const type = client.getMessageType(message)
// Returns: text, image, video, audio, document, sticker, location, contact, unknown

๐Ÿ“š Examples

EasyBot (Beginners)

import { quickBot } from "whatsapp-multi-client";

// 3 lines = complete bot!
quickBot()
    .when("hello").reply("Hi! ๐Ÿ‘‹")
    .start();

EasyBot with Action Chaining

import { createBot } from "whatsapp-multi-client";

createBot()
    .when("important")
        .react("โš ๏ธ")        // Reaction
        .type(2)            // 2 seconds typing
        .reply("Important!")  // Reply
        .react("โœ…")        // Another reaction
        .done()             // Back to bot
        
    .when("party")
        .react("๐ŸŽ‰")
        .type(1)
        .reply("Party! ๐Ÿฅณ")
        .done()
        
    .command("help", "I can help you!")
    .autoReply("hi", "Hello!")
    .start();

EasyBot Multi-Device

import { multiBot } from "whatsapp-multi-client";

multiBot(2) // 2 devices
    .when("test").reply("Multi-device test!")
    .command("status", "๐Ÿ“Š 2 devices active!")
    .start();

Multi-Device Bot

import { MultiWhatsAppClient } from "whatsapp-multi-client";

const multiClient = new MultiWhatsAppClient({
    maxDevices: 3,
    loadBalancing: 'round-robin'
});

// Add devices
await multiClient.addDevice('main-bot');
await multiClient.addDevice('backup-bot');
await multiClient.addDevice('support-bot');

// Commands for all devices
multiClient.setPrefix('!');

multiClient.addCommand('ping', async (msg) => {
    await msg.replyFromSameDevice(`Pong from ${msg.deviceId}! ๐Ÿ“`);
});

multiClient.addCommand('status', async (msg) => {
    const status = multiClient.getStatus();
    await msg.replyFromSameDevice(`๐Ÿ“Š ${status.activeDevices}/${status.totalDevices} devices active`);
});

multiClient.addCommand('broadcast', async (msg, args) => {
    const message = args.join(' ');
    await multiClient.broadcast(msg.from, { text: `๐Ÿ“ข ${message}` });
});

// Events
multiClient.on('message', async (msg) => {
    if (msg.text === 'hello') {
        // Load-balanced response
        await multiClient.sendMessage(msg.from, { 
            text: `Hello from ${msg.deviceId}! ๐Ÿ‘‹` 
        });
    }
});

// Connect all devices
await multiClient.connect();
console.log("๐ŸŽ‰ Multi-device bot running!");

Advanced Bot

import { WhatsAppClient } from "whatsapp-multi-client";

const client = new WhatsAppClient();
const prefix = "!";
client.setPrefix(prefix);

// Commands
client.addCommand('ping', async (msg) => {
    await msg.typeAndReply('Pong! ๐Ÿ“', 1000);
});

client.addCommand('info', async (msg) => {
    await msg.visualWrite(true);
    await new Promise(r => setTimeout(r, 2000));
    await msg.visualWrite(false);
    await msg.reply('Bot info: Running perfectly! โœ…');
});

// Events
client.on('message', async (msg) => {
    if (msg.text === 'hello') {
        await msg.simulateTyping('Hello! How are you?');
    }
});

await client.connect();

Interactive Bot

client.on('message', async (msg) => {
    if (msg.text.includes('how are you')) {
        await msg.visualWrite(true);
        await new Promise(r => setTimeout(r, 3000));
        await msg.visualWrite(false);
        await msg.reply('I\'m doing great, thanks! ๐Ÿ˜Š How about you?');
    }
    
    if (msg.text.includes('poll')) {
        await msg.quickType('Creating poll...');
        await msg.sendPoll('How do you like the bot?', ['Great!', 'Good', 'Okay', 'Bad']);
    }
});

๐ŸŽฎ Available Commands (Test Bot)

  • !help - Show all commands
  • !ping - Pong response
  • !stats - Show statistics
  • !kick @user - Kick user (admin only)
  • !debug - Debug information
  • !poll "Question" "Opt1" "Opt2" - Create poll
  • !demo - Typing demo
  • !customtype 3000 "Text" - Custom typing
  • !slowtype "Text" - Slow typing

๐Ÿ”ฅ Feature Count

Total: 120+ Functions and Features!

  • Message Functions: 15+
  • Group Functions: 8+
  • Permission Functions: 6+
  • Statistics Functions: 5+
  • Typing Functions: 8+
  • Command System: 10+
  • Event System: 8+
  • QR Functions: 3+
  • Utility Functions: 15+
  • Multi-Device System: 20+
  • ๐Ÿ†• EasyBot System: 25+

๐Ÿš€ Why Choose This Library?

๐ŸŽฏ Three APIs in One

  • EasyBot - 3-line bot creation for beginners
  • Advanced - Full control for professionals
  • Multi-Device - Scale with multiple accounts

๐Ÿ”ฅ Unique Features

  • Multi-Device Load Balancing - Industry first!
  • Action Chaining - jQuery-style bot building
  • Realistic Typing - Human-like interactions
  • Edge QR Integration - Seamless authentication
  • Template System - Dynamic content with variables

๐Ÿ’ช Production Ready

  • Persistent Auth - One-time setup
  • Auto Reconnection - Handles disconnections
  • Health Monitoring - Track device status
  • Error Handling - Graceful failure recovery
  • TypeScript Support - Full type definitions

๐Ÿ“ˆ Scalable Architecture

  • Load Balancing - Distribute message load
  • Failover System - Automatic device switching
  • Rate Limit Bypass - Multiple account limits
  • Plugin Ready - Extensible for v2.0

๐Ÿค Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Quick Contribute

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ”ฎ Roadmap (v2.0)

  • ๐Ÿ”Œ Plugin System - Extensible architecture
  • ๐Ÿ’พ Database Integration - Persistent storage
  • ๐ŸŒ Web Dashboard - Browser-based management
  • ๐Ÿ“… Scheduled Messages - Cron-like scheduling
  • ๐Ÿ›ก๏ธ Advanced Moderation - Auto-spam detection
  • ๐Ÿค– AI Integration - ChatGPT/Claude support
  • ๐Ÿ“Š Analytics Dashboard - Detailed insights
  • ๐ŸŽฎ Game Framework - Interactive bot games

๐Ÿ’– Support

  • โญ Star this repository if you find it helpful
  • ๐Ÿ› Report bugs via GitHub Issues
  • ๐Ÿ’ก Request features via GitHub Discussions
  • ๐Ÿ“ง Contact for commercial support

๐Ÿ† Contributors

Thanks to all contributors who make this project possible! ๐ŸŽ‰


Made with โค๏ธ for WhatsApp Automation

The most powerful WhatsApp bot library - from 3-line bots to enterprise multi-device systems!