A CLI tool for WhatsApp Web automation:
- Verify which phone numbers have active WhatsApp accounts.
- Send a controlled parts inquiry to a prepared supplier list.
The tool uses whatsapp-web.js and saves the WhatsApp Web session in .wwebjs_auth/ after login.
- Node.js >= 18
- A WhatsApp account for authentication
- Google Chrome or Chromium, used by Puppeteer
npm installOptional global link:
npm linknode src/index.js check -i numbers.txtThis will:
- Ask you to scan a WhatsApp QR code on the first run.
- Check every number in the input file.
- Save WhatsApp-registered numbers to
whatsapp_valid.csv. - Save non-WhatsApp numbers to
whatsapp_invalid.csv. - Save a run report beside the valid CSV.
node src/index.js check [options]Options:
-i, --input <file> Input file with phone numbers (required)
-o, --output <file> Output CSV for WhatsApp numbers (default: whatsapp_valid.csv)
--invalid <file> Output CSV for numbers without WhatsApp (default: whatsapp_invalid.csv)
-d, --delay <ms> Delay between checks in ms (default: 1500)
--no-session Do not save WhatsApp session; fresh login every time
-h, --help Show help
Examples:
node src/index.js check -i contacts.txt -o valid.csv --invalid no_whatsapp.csv
node src/index.js check -i numbers.txt -d 800
node src/index.js check -i numbers.txt --no-sessionsrc/sendInquiry.js is a prepared sender for the HP/HPE server-parts inquiry.
It sends this inquiry to the supplier list in the file:
- 96W Smart Storage Battery with cable, part numbers
727260-003/871264-001 - HP
507284-001, 300GB SAS 10K Dual Port Hot Pluggable 2.5in Hard Drive
The message asks for:
- Price for each item
- Condition: new, refurbished, or used
- Warranty period
- Dubai delivery availability
- Pickup option if delivery is not available
Run it with:
node src/sendInquiry.jsIf WhatsApp needs login, the script writes and opens a large local QR page:
whatsapp-login-qr.html
whatsapp-login-qr.svg
Scan it from WhatsApp:
Settings > Linked Devices > Link a Device
After sending, the script writes:
parts_inquiry_send_log.csv
The QR files and send log are generated runtime artifacts and are ignored by git.
Before reusing the sender for a different campaign, edit the contacts and message values in src/sendInquiry.js.
One phone number per line. CSV files are supported, but only the first column is read.
# comment lines are ignored
971501234567
+1 (555) 000-1234
+44-7700-900123
0044 7700 900456
Rules:
- Use international format with country code.
+, spaces, dashes, and parentheses are stripped.- Duplicate numbers are removed.
- Valid length is 7 to 15 digits.
| File | Contents |
|---|---|
whatsapp_valid.csv |
Registered WhatsApp numbers with contact status |
whatsapp_invalid.csv |
Numbers not registered on WhatsApp or failed during lookup |
whatsapp_valid_report.txt |
Summary report for a checker run |
parts_inquiry_send_log.csv |
Send status log for the parts inquiry sender |
On first run, scan the WhatsApp QR code from:
Settings > Linked Devices > Link a Device
The session is saved in .wwebjs_auth/, so later runs can reuse it.
To delete the saved session:
node src/index.js clear-sessionWhatsApp may temporarily block automation if requests are too fast.
- For small number checks,
--delay 1000is usually fine. - For large number checks, keep
--delay 1500or higher. - The inquiry sender waits between messages to reduce the chance of rate limits.
- If WhatsApp disconnects, wait a few minutes and retry.
wa-checker/
├── src/
│ ├── index.js # CLI entry point and commands
│ ├── checker.js # WhatsApp client and number-checking logic
│ ├── fileUtils.js # File reading/writing helpers
│ └── sendInquiry.js # Prepared WhatsApp parts-inquiry sender
├── .gitignore
├── package.json
└── README.md