Introduction
In this article, we will learn how to send WhatsApp messages using Command Line. To achieve this we have used MudSlide Tools. The Mudslide tool can send WhatsApp messages from the Command Line.
It is based on Bailey's WhatsApp API Library.
Now to run this we need command NPX. We have created a typescript project. I have uploaded the code, you can download it and use it.
STEP 1
Install Mudslide tools, Install only Nodejs 16 or higher version
Command
npm install -g mudslide
STEP 2
Check the version and confirm that this tool is installed
Command
npx mudslide -V
STEP 3
Command List of mudslide
Command
npx mudslide --help
STEP 4 - Login to WhatsApp
Login to WhatsApp, just like Web.Whatsapp.com. You are shown the QR Code. Scan it and log-in to it.
Command
npx mudslide login
After showing the QR you open WhatsApp on your phone. Go to Settings and go to the linked device and now scan the QR. After the QR scan, you are shown the Command Line √ Success message.
STEP 5 - Sending Message
There are two methods of sending Messages. You can send it to yourself and you can send to any other WhatsApp number.
1> Send to yourself
Command
npx mudslide send me "Hello World"
2 > Send to any other number
Command
npx mudslide send 91XXXXXX "Hello World"
XXXXX - Replace the mobile number where you want to send the message. Remember to always add the country code before the mobile number, in India country code is 91.
STEP 6 - List the WhatsApp Groups
Command
npx mudslide groups
In the output, you see the id and subject. The id is the Group id and Subject is your Group name.
STEP 7 - Send a message to a Group
To send a message to any Group you just need the group id and pass only numerical
Command
npx mudslide send-group 120363028580195954 "Hello"
STEP 8 - Show Current User Info
Command
npx mudslide me
Step 9 - Logout
Command
npx mudslide logout
Conclusion
In this article, we have learned how to easily send messages without using selenium or any other browser.
HAPPY CODING.