Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get selected messages in the active chat #1235

Open
Birol2010 opened this issue Jul 19, 2023 · 4 comments
Open

How to get selected messages in the active chat #1235

Birol2010 opened this issue Jul 19, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@Birol2010
Copy link

I searched documents but not found the selected messages in activechat object.
I also wonder how to select the messages.

@Birol2010 Birol2010 added needs triage question Further information is requested labels Jul 19, 2023
@icleitoncosta
Copy link
Contributor

I searched documents but not found the selected messages in activechat object.
I also wonder how to select the messages.

The requested functions don't exist in WAJS, but I added the label for us to add them in the future.

@icleitoncosta icleitoncosta added enhancement New feature or request and removed question Further information is requested needs triage labels Aug 28, 2023
@janardhan5031
Copy link

I searched documents but not found the selected messages in activechat object. I also wonder how to select the messages.

Me also trying to develop this feature. let us know if any body develop this

@ariona
Copy link

ariona commented Nov 21, 2024

Any update on this issue?

@ariona
Copy link

ariona commented Nov 22, 2024

My current solution is by traversing DOM tree,

function getSelectedMessages() {
  let selectedIds = Array.from(document.querySelectorAll("[role='row'] [data-id]")).filter(i=>i.querySelector('input:checked')).map(i=>i.dataset["id"])
  const selectedMsgs = WPP.whatsapp.MsgStore._models.filter(i=>selectedIds.includes(i.id._serialized))

  return selectedMsgs
}

// will return selected Messages object, and empty array if no selected message
console.log(getSelectedMessages())

It would be great to have this function baked into the lib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants