send the same text to multiple WhatsApp contacts

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
tsolignani
Posts: 187
Joined: 12 Jan 2019 11:53
Location: Vignola, Mo, Italy
Contact:

send the same text to multiple WhatsApp contacts

Post by tsolignani » 28 Sep 2019 11:09

Good morning everyone.

This is a bit generic, still...

Would it be possible and how to realize a flow where you have a text, you can pick some contacts (they change every time the flow runs, so every time you would start with contact picking) and send it along with individual messages?

Maybe with control UI but then how would I do the picking and then selecting afterwards?

Thank you.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: send the same text to multiple WhatsApp contacts

Post by Desmanto » 28 Sep 2019 19:30

The text is the same for all contacts right? If yes, you can simply use send intent to the whatsapp contact picker. You can pick multiple contacts afterward using control UI.

First, put start actitivity as shown here : viewtopic.php?f=5&t=7211#p20298
Change the text you want to send in the EXTRA. Then use Control UI

Code: Select all

sle = 200;

reclist = newList("Andy", "Bob", "School Project", "Main Office");

sleep(sle);
clickById("com.whatsapp:id/menuitem_search");
sleep(sle);

for(i in reclist)
{
  setText2ById("com.whatsapp:id/search_src_text", i);
  sleep(sle);
  clickById("com.whatsapp:id/contactpicker_row_name");
  sleep(sle);  
}

//clickById("com.whatsapp:id/send");
The contacts you want to send to should have unique name. If you have same name or duplicate or similar group name, it is your part to make them distinguishable. Change the elements in the {reclist} to be the exact name of the contact you want to send the text. The script should have loop upon the name and select each of them. Only the first name will be selected. So if you have the same person with number, only the last chatted number will be selected (which is usually the correct one).

Try the flow and if it pick them all properly, you can then uncomment the last line of the Control UI to test it out for real.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
tsolignani
Posts: 187
Joined: 12 Jan 2019 11:53
Location: Vignola, Mo, Italy
Contact:

Re: send the same text to multiple WhatsApp contacts

Post by tsolignani » 29 Sep 2019 14:21

Thank you.

The start activity works but I can select only up to five contacts and not more.

As regards the control UI part, I don't get it: if I have to change manually every time the reclist that wouldn't be an automation. Maybe I am missing something?

The text is the same, but the contacts I have to send it to changes every time.

If I could choose more than five contacts it would be ok, unfortunately I cannot.

Thank you.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: send the same text to multiple WhatsApp contacts

Post by Desmanto » 29 Sep 2019 17:54

I predict you might hit the 5 contacts limit if you use it to send to a lot of contacts. This is limitation from Whatsapp, there is nothing you can do with this limitation.
However you can use workaround by looping the start activity multiple times until you send to all your contacts.

The reclist above is for demonstration purpose. Of course, don't put the list inside the control UI. Instead change it automatically by selecting or other method, before the variable is passed to the Control UI.
I have to know first how do you define the contacts to send? How do you trigger the flow?

I imagine a simple trigger shortcut. Then you choose from several groups. Each groups contains a list of contacts to send. Example : "Family", "Office", "Gym" and etc.
You can create a nested map-list to store the contact for each group.

Code: Select all

group = newMapFromValues(
"Family", newList("Andy", "Bob", "Chris", "Dennis", "Eva", "Feny", "George", "Hilda"),
"Office", newList("Pat", "Quill", "Randy", "Shella"),
"Gym", newList("Xavier", "Yankee", "Zoe"));

choice = getMapKeys(group);
Use {choice} in the input dialog. Then after choosing the value, use script to get the list

Code: Select all

recgroup = group[value];
The reclist now will contain the list of the names of the group you have chosen.


For the repeated start activty when list is more than 5, you have to use loop checking recgroup to process only 5 per instance. replace the reclist in the Control UI to be

Code: Select all

reclist = removeElements(recgroup, 0, if(length(recgroup) > 5) 5 else length(recgroup));
This will take first 5 names from the recgroup, remove it and stored in the reclist. The Control UI loop process these 5 names.

Then after the Control UI, add expression

Code: Select all

isEmpty(recgroup);
True, do nothing (stop the flow). False, loop back to the Start Activity. This mean if you have 16 names in the chosen group, the flow will loop process 5 names per loop for 4 times (5, 5, 5, 1)
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
tsolignani
Posts: 187
Joined: 12 Jan 2019 11:53
Location: Vignola, Mo, Italy
Contact:

Re: send the same text to multiple WhatsApp contacts

Post by tsolignani » 30 Sep 2019 13:25

Thank you. Now I understand it a little better. I don't know if I can use groups, it's more random every time, every time I pick a different set of contacts, according to the text I have to share as well. But I'll do some tries and see what could do.

Thank you!

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: send the same text to multiple WhatsApp contacts

Post by Desmanto » 01 Oct 2019 17:26

If you have to pick different set of contacts, how can it be automated?
You have to set a defined group or maybe you can mention the contacts in the trigger (in case you trigger using some method that allow you to pass variable).
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
tsolignani
Posts: 187
Joined: 12 Jan 2019 11:53
Location: Vignola, Mo, Italy
Contact:

Re: send the same text to multiple WhatsApp contacts

Post by tsolignani » 10 Oct 2019 10:42

Thank you, I'll look over it and get back here. Thanks again.

Post Reply