whatsapp again: extracting ID of selected 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:

whatsapp again: extracting ID of selected contacts

Post by tsolignani » 02 Mar 2020 18:42

Good evening everyone.

Let's say I am into WhatsApp home, where you have last chats made in descending order.

I select some chats / contacts.

Is there a way to retrieve ID of selected contacts into automagic?

I tried with UI events, but it does not show. If, instead of selecting, I click and open a single chat, UI events record the name of the contact, but that would be too much time consuming.

What I would like to to is select a bunch of chat / contacts from WhatsApp home, retrieve their contacts I'd, then send the same text to the ones I had selected.

I can send the text, but I have no clue as to how to extract contacts Id of currently selected contacts.

Thank you.

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: whatsapp again: extracting ID of selected contacts

Post by anuraag » 02 Mar 2020 20:03

Are going to select contacts everytime?

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

Re: whatsapp again: extracting ID of selected contacts

Post by Desmanto » 03 Mar 2020 03:44

@tsolignani : By "send the same text", do you mean "SMS text"? (send once from Whatsapp and another from regular SMS)

To get all the Whatsapp thread name, you can loop upon the element id.

Code: Select all

contact = newList();
for(i in [0 to 20])  //20 just to ensure cover all the screen element)
  addElement(contact, getTextByIdAndIndex("com.whatsapp:id/conversations_row_contact_name", i));
removeElementValue(contact, null);
{contact} now contain list of all the last thread on top. You can then use input dialog to select those.

You can't select from Whatsapp directly and extract the checked box, since the check box doesn't return any element Id.

To extract other contact info, you can retrieve the name first and then query content provider.
viewtopic.php?f=6&t=7307
The link is for auto forward, but you can replace the {content_title} with the contact ID you selected. Try to experiment with other field in the query to get data you need.


But if what you want is just to send all of the contact with certain Whatsapp message, it is much easier to use share text.
Start Activity
Action : android.intent.action.SEND
Data Mime Type : text/plain
Explicit Component
Package Name : com.whatsapp
Class Name : com.whatsapp.ContactPicker
Extras

Code: Select all

putString("android.intent.extra.TEXT", "Put your message here");
Then after execution, select any contact/group you want to send the message.
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: whatsapp again: extracting ID of selected contacts

Post by tsolignani » 03 Mar 2020 10:30

anuraag wrote:
02 Mar 2020 20:03
Are going to select contacts everytime?
Thank you.

Yes. Every time I would like to create a temporary group of contacts to send a certain message. I don't need to keep it for it's alway different, I choose them «on the fly», send the message and that's it.

I am much better choosing with the latest chat, they are mostly last people I chatted with. Insted with the contact picker I am presented with a contact search and that way I cannot see which people could be interested, no joy.

Thank you.

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

Re: whatsapp again: extracting ID of selected contacts

Post by tsolignani » 03 Mar 2020 10:34

Desmanto wrote:
03 Mar 2020 03:44
@tsolignani : By "send the same text", do you mean "SMS text"? (send once from Whatsapp and another from regular SMS)

To get all the Whatsapp thread name, you can loop upon the element id.

Code: Select all

contact = newList();
for(i in [0 to 20])  //20 just to ensure cover all the screen element)
  addElement(contact, getTextByIdAndIndex("com.whatsapp:id/conversations_row_contact_name", i));
removeElementValue(contact, null);
{contact} now contain list of all the last thread on top. You can then use input dialog to select those.

You can't select from Whatsapp directly and extract the checked box, since the check box doesn't return any element Id.
I mean a text to send to whatsapp recipients via whatsapp, I guess SMS has nothing to do with what I need.

I understood your way to realize that, I'll think it over, thank you!

Post Reply