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-spammer-cli

v1.1.5

Published

A CLI tool to send automated WhatsApp messages

Readme

WhatsApp Spammer

A simple CLI tool to send automated WhatsApp messages using Puppeteer and Chrome's remote debugging.

Prerequisites

  • Node.js (>= 18.0.0)
  • pnpm package manager
  • Google Chrome or Chromium installed (supports Linux, macOS, and Windows)

Installation

From npm (recommended)

# Run directly with npx
npx whatsapp-spammer-cli <contact> "<message>" [--port PORT] [--count NUMBER] [--browser BROWSER]

# Or install globally
npm install -g whatsapp-spammer-cli
whatsapp-spammer <contact> "<message>" [--port PORT] [--count NUMBER] [--browser BROWSER]

From source (development)

  1. Clone or download this project
  2. Install dependencies:
pnpm install

Usage

Installed package

After installing globally or using npx:

whatsapp-spammer <contact> "<message>" [--port PORT] [--count NUMBER] [--browser BROWSER]

Development mode

Run the script directly from source:

pnpm run dev <contact> <message> [--port PORT] [--count NUMBER] [--browser BROWSER]

Arguments

  • contact (required): The name of the contact as it appears in WhatsApp
  • message (required): The message to send (use quotes for multi-word messages)
  • --port or -p (optional): Chrome remote debugging port (default: 3005)
  • --count or -c (optional): Number of messages to send (default: 1)
  • --browser or -b (optional): Path to browser executable (auto-detected if not specified)
  • --help or -h: Display help information

Examples

Using installed CLI:

# Basic usage (default port 3005, 1 message)
whatsapp-spammer "John Doe" "Hello there!"

# Send 10 messages
whatsapp-spammer zkaynl7 "Testing 123" --count 10

# Custom port with 500 messages
whatsapp-spammer Mom "Miss you" --port 9222 --count 500

# Using short flags
whatsapp-spammer "John" "Hello" -p 3005 -c 50

# Specify custom browser path
whatsapp-spammer "Alice" "Test message" --browser /usr/bin/chromium

# Mix and match flags in any order
whatsapp-spammer "Bob" "Hello" --count 20 --port 9000 --browser chrome

Development mode:

# Basic usage
pnpm run dev "John Doe" "Hello there!"

# With custom options
pnpm run dev zkaynl7 "Testing 123" --count 10 --port 3005

# Display help
pnpm run dev --help

Build from source

Build the TypeScript source to JavaScript:

# Build the project
pnpm run build

# Run the built version
pnpm start <contact> <message> [--port PORT] [--count NUMBER] [--browser BROWSER]

Example:

pnpm run build
pnpm start zkaynl7 "Hello World" --port 3005 --count 100

The build output goes to the ./build/ directory. The package is configured to run the compiled build/index.js when installed via npm.

How it works

  1. The script automatically detects and launches Chrome/Chromium with remote debugging enabled via launchBrowser
    • Supports Linux, macOS, and Windows through detectBrowser
    • Checks common installation paths defined in browserPaths
    • Allows manual browser path specification via --browser flag
    • Throws a helpful error if Chrome is not found
  2. Connects to Chrome using Puppeteer via sendWhatsappMessage
  3. Opens WhatsApp Web at the URL defined in WHATSAPP_WEB_URL
  4. Searches for the specified contact using selectors from selectors.ts
  5. Sends the message the specified number of times
  6. Disconnects from the browser

Project Structure

.
├── src/
│   ├── index.ts                    # Main CLI entry point
│   ├── features/
│   │   ├── browser/
│   │   │   ├── constants.ts        # Browser paths for different platforms
│   │   │   ├── detector.ts         # Auto-detect browser installation
│   │   │   ├── launcher.ts         # Launch Chrome with debugging
│   │   │   └── index.ts
│   │   └── whatsapp/
│   │       ├── client.ts           # WhatsApp message sender
│   │       ├── selectors.ts        # WhatsApp Web selectors
│   │       └── index.ts
│   └── shared/
│       └── contants.ts             # Shared constants
├── tests/                          # Test files
├── build/                          # Compiled JavaScript output
└── package.json

Notes

  • You must be logged into WhatsApp Web before running the script
  • Chrome will stay open after the script finishes
  • The script uses /tmp/chrome-profile as the user data directory on Linux/macOS
  • The script automatically launches Chrome - no need to start it manually
  • Make sure WhatsApp Web is accessible and you're logged in
  • Cross-platform support: Works on Linux, macOS, and Windows
  • If Chrome is not found, install Google Chrome or Chromium browser, or specify the path with --browser
  • Default message count is 1 (changed from 1000 for safety)

Troubleshooting

  • "Chrome/Chromium not found": Install Google Chrome or Chromium browser for your platform, or use --browser to specify the path
  • "Could not find the search box": Wait for WhatsApp Web to fully load (timeout is set to 120 seconds via WHATSAPP_LOAD_TIMEOUT_MS), you may need to scan the QR code first
  • Connection refused: The script auto-launches Chrome, wait a few seconds for it to start
  • Contact not found: Ensure the contact name matches exactly as shown in WhatsApp
  • Port already in use: Chrome might already be running on that port, use a different port number with --port

Warning

⚠️ Use responsibly! This tool can send many messages rapidly. Make sure you have permission from the recipient before using it. Start with a small number to test!

License

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

Author

Nick-Lemy ([email protected])

Repository

https://github.com/Nick-Lemy/whatsapp_spammer