Automatically Send Messages Or Files (Images,Videos,Documents..etc.) via WhatsApp v1.0

A simple task to send messages and/or files to your Whatsapp contacts.

  1. BrokenUpdate
    This is a simple task I created to send messages and/or files to your Whatsapp contacts. :)

    Tasker Plugins required to run this task:
    1. AutoInput: To tap on the Send button in WhatsApp.
    2. AutoShare/IntentTask: To send the Intent.
    Note: There's no need for AutoShare/IntentTask plugin if you're sending only a text message. The plugin is required only if you're sending a file.
    Setup:
    There are three tasks in the project - Whatsapp Send Message | Whatsapp Send File | Whatsapp IntentTask (Example)
    • Whatsapp Send Message: This task can be used to send plain text messages to your Whatsapp contacts. There are two variables in this task %wamessage and %wanumber. %wamessage contains the message to be sent. %wanumber contains the phone number (separate multiple numbers with a comma).
    • Whatsapp Send Files: It took me some time to get this task running. There are three variables in this task - %wanumber, %wafile and %wamessage. %wanumber contains the phone numbers separated by a comma. %wafile contains the full path of the files to be sent separated by a comma (Eg./storage/emulated/0/xxxx.jpg,/storage/emulated/0/XXXX/yyyy.doc ). %wamessage contains the caption/message to be included with the file. Captions can only be added to an image or a video file. The position of the caption in the %wamessage variable must match the position of the image/video file path in the %wafile variable.
    Example:
    • %wafile: /storage/emulated/0/abcd.jpg,/storage/emulated/0/efgh.doc,/storage/emulated /0/ijkl.mp4
    • %wamessage: This is an Image£?This is a Document£?This is a Video
    Note: £? is the separator used for the variable.
    Here 'This is an Image' caption will be added to the first file since it's an image. For the second file the caption 'This is a Document' will be ignored since it's a doc file. And for the last file the caption 'This is a Video' will be added since it's a video file. I've also created a variable to add a caption by default if no caption is specified. You can change this in the task as well.

    You might have to change the Wait Time between actions depending on your device. Sometimes when sending a huge video file, Whatsapp takes longer to load the file. In this case you might have to increase the Wait Time. Also I've noticed that while sending files stored in certain locations, AutoShare throws a FileUriExposedExceptionerror message. To counter this, you could temporarily copy the files to a different location using Tasker and then delete it later after sharing.
    • Whatsapp IntentTask (Example): In case you don't have AutoShare, you can use the IntentTask Plugin which works exactly like the AutoShare Intent Action. I've created a sample configuration task using IntentTask Plugin for your reference. All you got to do is replace the AutoShare Intent action in the main task with the IntentTask action. You might have to mess with the variables for it to work. :)
    Project:
    Whatsapp - Taskernet
    Whatsapp - Google Drive (Also contains a text file with AutoShare Intent for your reference)
    Note:
    This task can only send messages/files to contacts that are already stored in you phone book. While entering the phone numbers, make sure that it's in E.164 format without the + sign.
    If you need any help running this task or would like to suggest something, feel free to drop a message. :)
    Edit:
    Broadcast Group: If you want to send text messages to multiple contacts, then instead of using the above task you could create a Whatsapp Broadcast Group and pin it at the top.
    Then using Tasker, Launch WA >> tap on the Broadcast Group using AutoInput >> use the new Tasker Keyboard Action to enter the text >> Tap on the Send Button using AutoInput >> Back out of WA using AutoInput
    This method is much faster and you can send messages to a large number of people within a fraction of time.
    Unfortunately, you cannot send files directly using this method.

    Group Message: Similar to the Broadcast Group, you can send text messages to groups as well (cannot send files directly). But unlike Broadcast Group, there's no need to pin it at the top. Of course you could use a similar approach, but a much faster method is to open the Group directly using the Group Uri.
    For this you'll need the Group Invite Link. If you're not the admin of the group, try asking the admin for the link. It's format is https://chat.whatsapp.com/xxxxxxxxxxxxx where xxxx..xx is the Group ID. Once you know the Group ID, to open the group all you got to do is
    Tasker >> Browse URL - whatsapp://chat?code=Group_ID
    This will open the group on WA. You'll get a Checking invite link dialogue, but that's normal (no way to bypass it as of now). After this you can use Tasker to enter text, AI to click on the Send button and back out of WA.

    PS. Note that if the admin revokes the invite link, you'll have to use the new Group ID from the new link.
    Enjoy!