You can use the Mudslide console client to send messages to the WhatsApp messenger directly from the command line (shell) or script. Sysops often use it to send notifications to WhatsApp from shell scripts, monitoring systems, and other automation scenarios.
This article explains how to use Mudslide to send messages to WhatsApp from the command prompt or PowerShell script in Windows. Mudslide requires the Node.js framework (with the NPM package manager) and Git client to be installed on a machine (or download a compiled mudslide.exe
executable for Windows).
- Installing Node.js with NPM on Windows is described here.
- The Git client can be installed using MSI (https://git-scm.com/download/win) or WinGet package manager:
winget install --id Git.Git -e --source winget
Install the Mudslide package and all its dependencies from the Node.js repository:
npm install -g mudslide
To run Mudslide from the command line, use the npx tool (used to run npm packages from the CLI).
List the available console arguments and options for the mudslide command:
npx mudslide -v
The Mudslide client on a computer should be authenticated as a second WhatsApp client in your account to send WhatsApp messages. Run the command:
npx mudslide login
Scan the QR code that appears in the console from WhatsApp on your smartphone (Settings -> Linked Devices -> Link a device).
If authentication is successful, the following message appears on the command prompt
Success: Logged in
Run the following command to send a test message to yourself in WhatsApp:
npx mudslide send me "Hello World"
Send a message to WhatsApp address by a phone number (doesn’t require the target phone number to be saved in contacts in advance)
npx mudslide send 4998765432188 "Hello World"
npx mudslide groups
).If you need to break the message into lines, add a line break with the \n
control character:
npx mudslide send 4998765432188 "Hello\nWorld"
Send a local image file from the computer to WhatsApp (PNG, JPG, GIF formats are supported):
npx mudslide send-image 4998765432100 C:\src\image123.jpg
Attach a file to the message:
npx mudslide send-file 4998765432100 C:\src\scan.pdf
Send a location (GPS coordinates):
npx mudslide@latest send-location me 48.159731 11.560668
Send a message to the WhatsApp group:
npx mudslide send-group 12345678910 "Hello"
Check the Mudslide client authentication status:
npx mudslide me
To end the Mudslide session and delete the WhatsApp token and cookies that were stored:
npx mudslide logout
You can also use compiled Mudslide executables, which are available for download on GitHub. For example, to use the Mudslide client on Linux, download the binary:
$ wget https://github.com/robvanderleek/mudslide/releases/download/0.31.0/mudslide-linuxstatic-x64
$ chmod +x mudslide-linuxstatic-x64
$ mv mudslide-linuxstatic-x64 /usr/local/bin/mudslide
To use the Mudslide client to send messages, for example from the Zabbix monitoring system, authenticate to WhatsApp from the service user account:
$ sudo -u zabbix mudslide -c /tmp/mudslide-cache login
So you can send messages to WhatsApp directly from your scripts or monitoring system without using a browser, Selenium framework, or web automation tools.