3mora2 / WPP_Whatsapp

WPP_Whatsapp aim of exporting functions from WhatsApp Web to the python, which can be used to support the creation of any interaction, such as customer service, media sending, intelligence recognition based on phrases artificial and many other things, use your imagination
MIT License
75 stars 12 forks source link

How to make client.getMessages() work #17

Closed alexferra closed 10 months ago

alexferra commented 10 months ago

Hello,

how does client.getMessages() work ?

Im able to send messages but not open a certain chat and get messages. how can I get the chatID for a specific user? How to get the chatid by having the userId and then getting all messages from them?

thank you in advance

3mora2 commented 10 months ago

userId or chatid is same -> [number]@c.us or user number only and will fix it

user_number = "2010******"
messages =  client.getMessages(user_number )
alexferra commented 10 months ago

@3mora2 image I get this error. The same number works to send message to, but I can't getMessages, I can also get unread messages successfully

the client.getMessages(user_number ) returns this error

3mora2 commented 10 months ago

It's not error, it was async method but i update it, so update lib by use pip install git+https://github.com/3mora2/WPP_Whatsapp

alexferra commented 10 months ago

@3mora2 I tried calling with await and also updating but still getting same error. Also tried other get messages methods and similar issue.

3mora2 commented 10 months ago

I try get_messages now and it work fine post full error

alexferra commented 10 months ago

if I use await I get:

File "C:\Users\Alefe\AppData\Roaming\Python\Python311\site-packages\WPP_Whatsapp\api\layers\HostLayer.py", line 108, in self.page.on('close', lambda: self.clearInterval(self.checkStartInterval)) ^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'Whatsapp' object has no attribute 'checkStartInterval'

If I use 1.5.1, I get the same issue I initially posted.

@3mora2 can you push the change to a new package ?

3mora2 commented 10 months ago

update now pip install git+https://github.com/3mora2/WPP_Whatsapp

alexferra commented 10 months ago

image @3mora2 can you please update the package

3mora2 commented 10 months ago

Ok

alexferra commented 10 months ago

@3mora2 thanks seem to work now