├── .github └── workflows │ ├── build_mdtest.yml │ └── check_update.yml ├── README.md ├── VARIABLES.md ├── build_whatsmeow5.sh ├── commit_hash.txt └── res ├── 1) Correcting imports.sh ├── 10) Add support for event handlers.sh ├── 2) Add functions.sh ├── 3) Handle flags.sh ├── 4) Support instance naming.sh ├── 5) Add args support.sh ├── 6) Add pair-code support.sh ├── 7) Trim and fix code.sh ├── 8) Add extended support for sending messages types.sh ├── 9) Add extended support for receiving messages types.sh └── build_dynamic.sh /.github/workflows/build_mdtest.yml: -------------------------------------------------------------------------------- 1 | name: Build MdtestV5 2 | 3 | on: 4 | repository_dispatch: 5 | types: [build-mdtest] 6 | workflow_dispatch: 7 | 8 | concurrency: 9 | group: check-and-build-mdtest 10 | 11 | jobs: 12 | get_commit_hash: 13 | runs-on: ubuntu-latest 14 | outputs: 15 | commit-hash: ${{ steps.get-commit-hash.outputs.commit_hash }} 16 | 17 | steps: 18 | - name: Get Commit Hash 19 | id: get-commit-hash 20 | run: | 21 | git clone --depth 1 https://github.com/tulir/whatsmeow 22 | cd whatsmeow 23 | echo "commit_hash=$(git show HEAD | grep -Eo '^commit [0-9a-f]{40}' | awk '{print $2}')" >> "$GITHUB_OUTPUT" 24 | 25 | build_mdtest: 26 | needs: get_commit_hash 27 | runs-on: ubuntu-latest 28 | permissions: 29 | contents: write 30 | strategy: 31 | matrix: 32 | platform: [arm, aarch64, i686, x86_64] 33 | 34 | steps: 35 | - name: Set Build Architecture 36 | run: | 37 | if [ "${{ matrix.platform }}" = "aarch64" ]; then 38 | echo "ARCH_NAME=arm64" >> $GITHUB_ENV 39 | elif [ "${{ matrix.platform }}" = "i686" ]; then 40 | echo "ARCH_NAME=x86" >> $GITHUB_ENV 41 | else 42 | echo "ARCH_NAME=${{ matrix.platform }}" >> $GITHUB_ENV 43 | fi 44 | 45 | - name: Build Mdtest 46 | run: | 47 | # Support for ARM and AARCH64 48 | if [[ "${{ matrix.platform }}" == "arm" || "${{ matrix.platform }}" == "aarch64" ]]; then 49 | docker run --rm --privileged aptman/qus -s -- -p arm aarch64 50 | fi 51 | 52 | docker run --privileged --name "mdtest-${{ env.ARCH_NAME }}" "termux/termux-docker:${{ matrix.platform }}" bash -c " 53 | while true; do yes | pkg upgrade -y && break; done && \ 54 | pkg install -y git && \ 55 | export TERMUX_VERSION="0.118.0" && \ 56 | git clone --depth 1 'https://github.com/$GITHUB_REPOSITORY' repo && \ 57 | cd repo && \ 58 | bash build_whatsmeow5.sh \ 59 | " 60 | 61 | docker cp "mdtest-${{ env.ARCH_NAME }}":/data/data/com.termux/files/home/repo/build/mdtest.zip . 62 | 63 | - name: Upload Release 64 | uses: svenstaro/upload-release-action@v2 65 | with: 66 | repo_token: ${{ secrets.GITHUB_TOKEN }} 67 | file: mdtest.zip 68 | asset_name: "mdtest-${{ env.ARCH_NAME }}.zip" 69 | tag: "MdtestV5-Assets" 70 | release_name: "Assets for Project MdtestV5" 71 | body: "This release of MdtestV5 uses whatsmeow repo commit hash: ${{needs.get_commit_hash.outputs.commit-hash}}" 72 | overwrite: true 73 | 74 | -------------------------------------------------------------------------------- /.github/workflows/check_update.yml: -------------------------------------------------------------------------------- 1 | name: Check And Push Commit Hash 2 | 3 | on: 4 | schedule: 5 | - cron: '0 0 * * 3' 6 | workflow_dispatch: 7 | 8 | concurrency: 9 | group: check-and-build-mdtest 10 | 11 | jobs: 12 | push_commit_hash: 13 | runs-on: ubuntu-latest 14 | permissions: 15 | contents: write 16 | 17 | steps: 18 | - name: Get Commit Hash 19 | run: | 20 | git clone --depth 1 https://github.com/tulir/whatsmeow target-repo 21 | cd target-repo 22 | echo "commit_hash=$(git show HEAD | grep -Eo '^commit [0-9a-f]{40}' | awk '{print $2}')" >> $GITHUB_ENV 23 | 24 | - name: Checkout repository 25 | uses: actions/checkout@v3 26 | with: 27 | fetch-depth: 1 28 | 29 | - name: Check And Push commit_hash.txt 30 | run: | 31 | if cat commit_hash.txt | grep -Eq "^${{ env.commit_hash }}$" &>/dev/null; then 32 | echo "Already Latest Commit" 33 | else 34 | echo "update=true" >> $GITHUB_ENV 35 | echo "${{ env.commit_hash }}" > commit_hash.txt 36 | git config user.name github-actions 37 | git config user.email github-actions@github.com 38 | git add commit_hash.txt 39 | git commit -m "Update commit_hash.txt" 40 | git push 41 | fi 42 | 43 | - name: Repository Dispatch Build Mdtest 44 | if: env.update == 'true' 45 | uses: peter-evans/repository-dispatch@v2 46 | with: 47 | event-type: build-mdtest 48 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **(This has been deprecated. Tasker-WA will succeed it)** 2 | 3 | # Description 4 | Send WhatsApp Text/Images/Videos/PDF/Documents/Voice/Poll Messages, plus many more types, automatically using Tasker. 5 | 6 | Also supports sending WhatsApp messages from the Terminal(Termux). 7 | 8 | Previous post intro:- 9 | 10 | >Recently I've been getting a lot of inquiries on how to send images, videos or documents in WhatsApp using Tasker. 11 | > 12 | >Possibly with the screen off, phone locked, without unlocking, etc. 13 | 14 | # Details 15 | Contains assets that are used for running Mdtest V5 directly in Tasker. 16 | 17 | Also supports sending WhatsApp messages from the Terminal(Termux). 18 | 19 | Made for Project Mdtest V5. 20 | 21 | # List Of Supported Features 22 | - Send Text Messages 23 | - Send Images 24 | - Send Videos 25 | - Send Audio 26 | - Send PDF/Documents 27 | - Send Link Previews (New!) 28 | - Send List messages (New!) 29 | - Experimental support for sending list messages. 30 | WhatsApp business account not supported, only normal WhatsApp account. 31 | More about it here [#372](https://github.com/tulir/whatsmeow/issues/372). 32 | - Send Poll messages 33 | - Mark as read 34 | - Revoke messages 35 | - Download Media Messages (New!) 36 | Now includes downloading media like:- 37 | - Images 38 | - Videos 39 | - Audio 40 | - Documents 41 | - Status 42 | - Contacts 43 | - Link previews 44 | - Location previews 45 | - Mute/Unmute chats (New!) 46 | - Pin/Unpin chats (New!) 47 | - Archive/Unarchive chats (New!) 48 | - Multi-Number/User support (New!) 49 | - Previously Mdtest could support only one WhatsApp number, but now you can have as many as you want 50 | - Receive details of incoming messages as Tasker variables. Can use this for automated replies. 51 | **-> Be sure to check [VARIABLE.md](https://github.com/HunterXProgrammer/Tasker-MdtestV5/blob/main/VARIABLES.md) for all the available variables.** 52 | Current list of message types that are supported and can be received as Tasker variables:- 53 | - **Text message** 54 | - text body 55 | - **Image message** 56 | - caption message 57 | - image file 58 | - **Video message** 59 | - caption message 60 | - video file 61 | - **Audio message** 62 | - audio file 63 | - **Document** 64 | - caption message 65 | - document name 66 | - document file 67 | - **Status message** 68 | - caption message 69 | - status media file 70 | - **Contact message** 71 | - contact display name 72 | - contact `.vcf` file 73 | - **Link message** 74 | - text body 75 | - link title 76 | - link description 77 | - link url 78 | - image preview file 79 | - **Location message** 80 | - latitude 81 | - longitude 82 | - image preview file 83 | - **Poll response message** 84 | - poll question 85 | - poll selected options 86 | - **Button response message** 87 | - button title 88 | - button body 89 | - button footer 90 | - selected button 91 | - **List response message** 92 | - list title 93 | - list body 94 | - list footer 95 | - list header 96 | - list button text 97 | - selected title 98 | - selected description 99 | - Added support to link WhatsApp using phone number pairing method 100 | 101 | ### Changes in Mdtest V5 Compared To Previous V4 102 | - Now can link WhatsApp using phone number pairing method. 103 | **(Old V4)** Previous method of scanning QR code was tiresome and needed a spare device. 104 | **(New V5)** Now with the new pairing method everything is done from the main device in a few seconds. 105 | - Better support for sending images/videos/audio. 106 | **(Old V4)** Previously needed to send an image thumbnail seperately along with the main media file. 107 | **(New V5)** Now no longer necessary, Mdtest(V5) handles it. 108 | - Added support for receiving media messages and downloading the media file. 109 | - Includes downloading images/videos/audio/documents/status/contacts/links/location previews. 110 | - To enable receiving media messages and downloading media in **Tasker** set variable **`%save_media` = `true`** 111 | The media files are stored in **`/data/data/net.dinglisch.android.taskerm/files/whatsmeow5/mdtest.7774/media`** **(where `7774` = `%port`)** 112 | - To enable receiving media messages and in **Terminal(Termux)** pass the **`--save-media`** flag when starting `mdtest`. 113 | The media files are stored in **`~/whatsmeow5/mdtest/media`** 114 | - Added support to send link preview messages. 115 | Only for websites that support the **[Open Graph](https://ogp.me/)** protocol. 116 | **Eg:- `https://github.com/HunterXProgrammer/Tasker-MdtestV5`** 117 | 118 | # Disclaimer 119 | You are responsible for what you do with this. 120 | 121 | # Instructions 122 | ### For Tasker Users 123 | Check the Tasker Reddit **[post](https://www.reddit.com/r/tasker/comments/15ydqa1/project_share_sendreceive_whatsapp_message/)** for more info and importable Taskernet links. 124 | 125 | ### For CLI Users 126 | **NOTE:-** 127 | >This section is helpful for those who want to make shell scripts to use `mdtest` to send messages 128 | > 129 | > Not recommended for Tasker beginners since there are ready made Taskernet links in the Tasker Reddit Post that you can import. 130 | 131 | #### CLI In Tasker 132 | Added preliminary CLI support to run `mdtest` from within Tasker itself using action [Run Shell]. 133 | 134 | 1\) Set it up as described in this Tasker Reddit **[post](https://www.reddit.com/r/tasker/comments/15ydqa1/project_share_sendreceive_whatsapp_message/)**. 135 | 136 | This will prepare Tasker to enable CLI support natively. 137 | 138 | Your [Run Shell] action to use `mdtest` will look like this - 139 | 140 | #!/system/bin/sh 141 | mdtest_dir="/data/data/net.dinglisch.android.taskerm/files/whatsmeow5/mdtest" 142 | cd $mdtest_dir/../mdtest.7774 143 | sh $mdtest_dir/mdtest COMMAND PARAMETERS 144 | 145 | #### CLI In Termux 146 | CLI Setup:- 147 | 148 | 1\) Install and open **[Termux](https://f-droid.org/en/packages/com.termux/)** in your device. 149 | 150 | 2\) Grab the pre-compiled binary from **[releases](https://github.com/HunterXProgrammer/Tasker-MdtestV5/releases/tag/MdtestV5-Assets)** or use the build script to compile it yourself in Termux. 151 | 152 | **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 - 153 | 154 | 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 155 | 156 | OR 157 | 158 | You can build and compile it by yourself in Termux - 159 | 160 | rm -rf Tasker-MdtestV5 &>/dev/null 161 | git clone https://github.com/HunterXProgrammer/Tasker-MdtestV5 162 | cd Tasker-MdtestV5 163 | bash build_whatsmeow5.sh 164 | cd .. 165 | 166 | 3\) After that link with WhatsApp like this - 167 | 168 | >Now to connect it to WhatsApp - 169 | > 170 | >Type - 171 | > 172 | >`cd ~/whatsmeow5/mdtest; ./mdtest pair-phone 919876543210` 173 | > 174 | >(Here "91" is the country code and "9876543210" is the number. Adjust as needed) 175 | > 176 | >This will generate the linking code. 177 | > 178 | >You can copy the linking code and paste it in WhatsApp via notification 179 | > 180 | >or by open WhatsApp -> ⋮ (menu) -> Linked Devices -> Link with phone number 181 | > 182 | >Wait about 20s for pairing to complete. All done. 183 | 184 | This finishes the CLI setup. 185 | 186 | Your script will look like this - 187 | 188 | #!/data/data/com.termux/files/usr/bin/bash 189 | cd ~/whatsmeow5/mdtest 190 | ./mdtest FLAGS COMMAND PARAMETERS 191 | 192 | ### Commands And Parameters 193 | 194 | The **FLAGS** are - 195 | 196 | --mode 197 | Select mode: none, both or send 198 | (default option: none) 199 | - both -> Mdtest will receive mesages and as well as send messages 200 | - send -> Mdtest will only send messages, not receive. 201 | 202 | --save-media 203 | Download And Save Media. 204 | - This flag also enables receiving media message types 205 | such as:- images, videos, audio, documents, contacts, 206 | status, location previews. 207 | - Media saved to ~/whatsmeow5/mdtest/media 208 | - Note:- To be used in conjuction with "--mode " 209 | Will only be effective if "" is "both" 210 | 211 | --port 212 | Port can be anything from 1024 ~ 65535 213 | It must not be 9990 214 | (default option: 7774) 215 | - Mdtest accepts requests on this port. 216 | - Note:- To be used in conjuction with "--mode " 217 | Will only accept requests if "" is "both" or "send" 218 | 219 | --auto-delete-media 220 | Delete Downloaded Media After 30s 221 | - Useful for auto-deleting rubbish media that probably won't 222 | ever be used. 223 | - The idea is that if the user doesn't use the 224 | downloaded media after 30s, save space by deleting 225 | what is most likely redundant files. 226 | - Note:- To be used in conjunction with "--save-media" 227 | 228 | The **COMMAND** and **PARAMETERS** are:- 229 | 230 | send 231 | sendimg [caption] 232 | sendvid