Mdtest V5 - Sending WhatsApp messages from Tasker in Android. Also supports terminal (Termux).
(This has been deprecated. Tasker-WA will succeed it)
Description
Send WhatsApp Text/Images/Videos/PDF/Documents/Voice/Poll Messages, plus many more types, automatically using Tasker.Also supports sending WhatsApp messages from the Terminal(Termux).
Previous post intro:-
>Recently I've been getting a lot of inquiries on how to send images, videos or documents in WhatsApp using Tasker. > >Possibly with the screen off, phone locked, without unlocking, etc.
Details
Contains assets that are used for running Mdtest V5 directly in Tasker.Also supports sending WhatsApp messages from the Terminal(Termux).
Made for Project Mdtest V5.
List Of Supported Features
- Send Text Messages
- Send Images
- Send Videos
- Send Audio
- Send PDF/Documents
- Send Link Previews (New!)
- Send List messages (New!)
- Send Poll messages
- Mark as read
- Revoke messages
- Download Media Messages (New!)
- Mute/Unmute chats (New!)
- Pin/Unpin chats (New!)
- Archive/Unarchive chats (New!)
- Multi-Number/User support (New!)
- Receive details of incoming messages as Tasker variables. Can use this for automated replies.
.vcf file
- Link message
- text body
- link title
- link description
- link url
- image preview file
- Location message
- latitude
- longitude
- image preview file
- Poll response message
- poll question
- poll selected options
- Button response message
- button title
- button body
- button footer
- selected button
- List response message
- list title
- list body
- list footer
- list header
- list button text
- selected title
- selected description
- Added support to link WhatsApp using phone number pairing method
Changes in Mdtest V5 Compared To Previous V4
- Now can link WhatsApp using phone number pairing method.
- Better support for sending images/videos/audio.
- Added support for receiving media messages and downloading the media file.
%save_media = true
The media files are stored in /data/data/net.dinglisch.android.taskerm/files/whatsmeow5/mdtest.7774/media (where 7774 = %port)
- To enable receiving media messages and in Terminal(Termux) pass the --save-media flag when starting mdtest.
The media files are stored in ~/whatsmeow5/mdtest/media
- Added support to send link preview messages.
https://github.com/HunterXProgrammer/Tasker-MdtestV5
Disclaimer
You are responsible for what you do with this.Instructions
For Tasker Users
Check the Tasker Reddit post for more info and importable Taskernet links.For CLI Users
NOTE:- >This section is helpful for those who want to make shell scripts to usemdtest to send messages
>
Not recommended for Tasker beginners since there are ready made Taskernet links in the Tasker Reddit Post that you can import.
CLI In Tasker
Added preliminary CLI support to runmdtest from within Tasker itself using action [Run Shell].
1\) Set it up as described in this Tasker Reddit post.
This will prepare Tasker to enable CLI support natively.
Your [Run Shell] action to use mdtest will look like this -
#!/system/bin/sh mdtest_dir="/data/data/net.dinglisch.android.taskerm/files/whatsmeow5/mdtest" cd $mdtest_dir/../mdtest.7774 sh $mdtest_dir/mdtest COMMAND PARAMETERS
CLI In Termux
CLI Setup:-1\) Install and open Termux in your device.
2\) Grab the pre-compiled binary from releases or use the build script to compile it yourself in Termux.
Eg:- Depending on your device architecture(use uname -m to find out), you can download for arm,arm64(aarch64),x86 and x86_64 like this -
arch=arm64 && curl -L -o "mdtest-${arch}.zip" "https://github.com/HunterXProgrammer/Tasker-MdtestV5/releases/download/MdtestV5-Assets/mdtest-${arch}.zip" && mkdir -p ~/whatsmeow5/mdtest && unzip -o -d ~/whatsmeow5/mdtest mdtest-${arch}.zip && chmod -R 744 ~/whatsmeow5/mdtest/mdtest
OR
You can build and compile it by yourself in Termux -
rm -rf Tasker-MdtestV5 &>/dev/null git clone https://github.com/HunterXProgrammer/Tasker-MdtestV5 cd Tasker-MdtestV5 bash build_whatsmeow5.sh cd .. 3\) After that link with WhatsApp like this -
>Now to connect it to WhatsApp - > >Type - > >cd ~/whatsmeow5/mdtest; ./mdtest pair-phone 919876543210 > >(Here "91" is the country code and "9876543210" is the number. Adjust as needed) > >This will generate the linking code. > >You can copy the linking code and paste it in WhatsApp via notification > >or by open WhatsApp -> ⋮ (menu) -> Linked Devices -> Link with phone number > >Wait about 20s for pairing to complete. All done.
This finishes the CLI setup.
Your script will look like this -
#!/data/data/com.termux/files/usr/bin/bash cd ~/whatsmeow5/mdtest ./mdtest FLAGS COMMAND PARAMETERS
Commands And Parameters
The FLAGS are -
--mode
The COMMAND and PARAMETERS are:-
send
The "<>" means required, the "[ ]" means optional.
Note About JID
For single contacts, JID is usually the country-code followed by the phone-number and appended with "@s.whatsapp.net". Eg:- Say country-code is "91", then JID will be -> 919876543210@s.whatsapp.netFor group contacts, JID is usually the group phone-number appended with "@g.us". Eg:- 1234567890987654321@g.us
Credits
whatsmeow - Go librarymdtest is based on.
Termux - The best Android terminal. Allows compiling mdtest natively without needing PC or cross-toolchains. ffmpeg binaries used from here.
Comment by OwlIsBack - Java functions used in Tasker to get per-line buffer of shell command.