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 LinuxPowerShellWindows 11Windows Server 2022

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

Configure NTP Time Source for Active Directory Domain

May 6, 2025

How to Cancel Windows Update Pending Restart Loop

May 6, 2025

View Windows Update History with PowerShell (CMD)

April 30, 2025

Cannot Install Network Adapter Drivers on Windows Server

April 29, 2025

Change BIOS from Legacy to UEFI without Reinstalling...

April 21, 2025

Leave a Comment Cancel Reply

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

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMware
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • 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
  • AD Domain Join: Computer Account Re-use Blocked

    March 11, 2025
  • How to Write Logs to the Windows Event Viewer from PowerShell/CMD

    March 3, 2025
  • How to Hide (Block) a Specific Windows Update

    February 25, 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
  • Turn Linux Computer into Wi-Fi Access Point (Hotspot)
  • Get Started with Docker on Windows (WSL2) without Docker Desktop
  • Adding Trusted Root Certificates on Linux
Footer Logo

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


Back To Top