Windows OS Hub
  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux

 Windows OS Hub / PowerShell / Send a WhatsApp Message from the CommandLine (Shell)

December 3, 2024

Send a WhatsApp Message from the CommandLine (Shell)

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.

The Mudslide project (https://github.com/robvanderleek/mudslide) is based on the Baileys library. Baileys is the unofficial open-source library for JavaScript/TypeScript developers, used to interact with the WhatsApp Web API via WebSockets.

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

Install WhatsApp Mudslide console client on Windows

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

mudslide command line options

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).

mudslide QR code to login as a linked device to WhatsApp

If authentication is successful, the following message appears on the command prompt

Success: Logged in

successful authentication to interact with the WhatsApp API

Run the following command to send a test message to yourself in WhatsApp:

npx mudslide send me "Hello World"

Send a test WhatsApp message from the Windows CLI

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"

The messages can be sent to the recipient in the WhatsApp ID format. This can be either a user address or a group ID, for example, [email protected] (list your WhatsApp groups/chats: 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

mudslide: attach file or image to WhatsApp message

Send a message to the WhatsApp group:

npx mudslide send-group 12345678910 "Hello"

Check the Mudslide client authentication status:

npx mudslide me

npx mudslide me - check WhatsApp authentication status

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.

Examples of how to send messages from the command line to other messengers:

  • Send Telegram Messages from PowerShell
  • How to use PowerShell to send a message to the Teams channel

0 comment
3
Facebook Twitter Google + Pinterest
LinuxPowerShellWindows 11Windows Server 2022
previous post
How to Verify a File Hash (Checksum) on Windows
next post
Rollback Microsoft Office to an Earlier Version After an Update

Related Reading

How to Assign (Passthrough) a Physical GPU to...

June 11, 2024

Extend an Expired User Password in Active Directory

December 23, 2024

Adding ESXi Host to VMware vCenter Server (vCSA)

March 12, 2024

How to Add or Remove Pinned Folders to...

August 11, 2024

Check the Software Installation/Removal History in Windows

October 8, 2024

Configure File and Folder Access Auditing on Windows...

July 8, 2024

How to Create, Delete, and Manage System Restore...

March 14, 2024

How to Export MS Teams Chat History with...

March 12, 2024

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Recent Posts

  • Configuring Windows Protected Print Mode (WPP)

    May 19, 2025
  • Map a Network Drive over SSH (SSHFS) in Windows

    May 13, 2025
  • Configure NTP Time Source for Active Directory Domain

    May 6, 2025
  • Cannot Install Network Adapter Drivers on Windows Server

    April 29, 2025
  • Change BIOS from Legacy to UEFI without Reinstalling Windows

    April 21, 2025
  • How to Prefer IPv4 over IPv6 in Windows Networks

    April 9, 2025
  • Load Drivers from WinPE or Recovery CMD

    March 26, 2025
  • How to Block Common (Weak) Passwords in Active Directory

    March 25, 2025
  • Fix: The referenced assembly could not be found error (0x80073701) on Windows

    March 17, 2025
  • Exclude a Specific User or Computer from Group Policy

    March 12, 2025

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Fixing ‘The Network Path Was Not Found’ 0x80070035 Error Code on Windows
  • Recovering Files from BitLocker Encrypted Drive
  • Install Any OS from ISO Image over Network with iVentoy
  • Monitoring Domain Name Expiration Date with Zabbix
  • Printing from Linux to a Windows Shared Printer
  • Get Started with Docker on Windows (WSL2) without Docker Desktop
  • Turn Linux Computer into Wi-Fi Access Point (Hotspot)
Footer Logo

@2014 - 2024 - Windows OS Hub. All about operating systems for sysadmins


Back To Top