Is there a way to open the contact window by id?
I believe I've seen some functions that can be exposed to do that, but the library isn't really meant to control anything in the UI. It should be used to programatically interact with whatsapp.
May I ask what would the use case for this be?
In case this ever needs to be implemented:
window.Store.Cmd.chatInfoDrawer(window.Store.Chat.get("[email protected]"))
Yeah, there鈥檚 definitely ways to do it... but like I said, this library鈥檚 intention is not to do anything with the UI, but rather provide a way to programatically act as a WhatsApp client. The current way to do this is running WhatsApp Web, but everything that has to do with WAWeb itself should be abstracted.
I鈥檇 still like to know what the intention of the OP is, to see if maybe there鈥檚 some other functionality that should be included and they鈥檙e just needing to use the UI as a workaround or what exactly the issue is
On my part: I currently use it to send the profile as an image after taking a screenshot. This way I can send the image of the user and _impress_ them, instead of giving a normal user output.
I can see why it isn't a priority or a direct focus. If I may, I would like to argue; that if it does not limit, why not add it as a feature?
On the other hand if UI is intentionally to be left out, maybe an alternative would be to add it as a plugin and make the whole package plugin compatible.
@pedroslopez,
I'm filtering unanswered messages and with that I would open the chat with just one click.
@Aliyss, thks!!! I still haven't managed to make it work, I'm going to study it.
@Aliyss
When I click now, it stays in the same chat, but it opens the chat information that I would like to open, not the chat itself.
Ah I misunderstood in that case. My Code only opens the right drawer. I thought you meant that, concerning the Contact Window.
Maybe the response below can help you:
https://github.com/pedroslopez/whatsapp-web.js/issues/179#issuecomment-632763779
@Aliyss
Yes, it helped a lot. But I created a list of chats with answers pending in a second window linked to the bot. And I would like to open the chat by clicking on it in that list.
Look what happens when you run your code:
https://i.imgur.com/GHV11jo.png
@franciscol99 Yes. That is intentional behavior.
I updated the Pull Request above. You can try that.
It makes use of the following:
window.Store.Cmd.openChatAt(window.Store.Chat.get("[email protected]"))
The functions are:
chat.openWindow()
or
client.openChatWindow("[email protected]")
@Aliyss Thank you! Very good!
Perfect!!!
Has a function to open the chat in a specific message?
When someone mentions me, I get a notification.
I would like to click on that notification and go straight to the message.
It happens in groups when someone marks you.
@franciscol99 the interface options have been officially added.
You can now use the function openChatWindow now:
client.interface.openChatWindow("[email protected]");
I'm still trying to figure out the Msg jump/scroll part.
But added this for the moment:
client.interface.openMessageWindow("yourmessageid");
@Aliyss taking a quick look it seems like openChatAt takes a second parameter that has some options to scroll to a specific message. Simulating clicking on a reply inputs this object:
collection: ...
highlightMsg: true
key: undefined
msg: ...
slideToMsg: true
collection seems to be the currently loaded messages in that chat (not sure) and msg seems to be the targeted message.
It seems like there's also another function that takes you to unread messages.
I will look into it.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.