A simple CLI tool to send automated WhatsApp messages using Puppeteer and Chrome's remote debugging.
- Node.js installed
 - Google Chrome installed
 
- Clone or download this project
 - Install dependencies:
 
npm installRun the script with the following command:
npm run dev <contact> <message> [--port PORT] [--count NUMBER]contact(required): The name of the contact as it appears in WhatsAppmessage(required): The message to send (use quotes for multi-word messages)--portor-p(optional): Chrome remote debugging port (default: 3005)--countor-cor--messagesor-m(optional): Number of messages to send (default: 1000)
# Basic usage (default port 3005, 1000 messages)
npm run dev "John Doe" "Hello there!"
# Send only 10 messages
npm run dev zkaynl7 "Testing 123" --count 10
# Custom port with 500 messages
npm run dev Mom "Miss you" --port 9222 --count 500
# Just custom port (default 1000 messages)
npm run dev "Best Friend" "Spam test" --port 9222
# Using short flags
npm run dev "John" "Hello" -p 3005 -c 50
# Mix and match flags in any order
npm run dev "Alice" "Test message" --count 20 --port 9000You can also build the TypeScript file and run the compiled JavaScript:
# Build
npm run build
# Run
npm start <contact> <message> [--port PORT] [--count NUMBER]Example:
npm run build
npm start zkaynl7 "Hello World" --port 3005 --count 100- The script automatically launches Chrome with remote debugging enabled
 - Connects to Chrome using Puppeteer
 - Opens WhatsApp Web
 - Searches for the specified contact
 - Sends the message the specified number of times (numbered 1 to N)
 - Disconnects from the browser
 
- You must be logged into WhatsApp Web before running the script
 - Chrome will stay open after the script finishes
 - The script uses 
/tmp/chrome-profileas the user data directory - The script automatically launches Chrome - no need to start it manually
 - Make sure WhatsApp Web is accessible and you're logged in
 - Messages are numbered from 1 to the number you specify (e.g., "Hello 1", "Hello 2", etc.)
 
- "Could not find the search box": Wait for WhatsApp Web to fully load, you may need to scan the QR code first
 - Connection refused: The script auto-launches Chrome, wait 3 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