You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to read unread messages using the below code. I did not get any messages with the default arguments for the 'get_unread' method. But by passing 'use_unread_count', I am able to get the list of unread messages. But one issue is, it doesn't mark these chat messages as 'read' in mobile (it does get marked as read in browser view). So, when I rerun below code, it again returns the older messages.
from openwa import WhatsAPIDriver, MessageGroup
import time
driver = WhatsAPIDriver()
print("Waiting for QR")
while not driver.wait_for_login():
time.sleep(3)
print("Bot started")
print("Getting Existing Unread Messages..")
# # Get Unread Messages
message_groups = driver.get_unread(use_unread_count=True)
print(message_groups)
for i,message_group in enumerate(message_groups):
for j,msg in enumerate(message_group.messages):
print(f'Message {j}: {msg}')
# Mark Chat as Read
driver.chat_send_seen(msg.chat_id)
try:
print(f'Message Content is: {msg.content}')
except:
pass
print('Bot stopped')
Instead of using the code, if I manually click a chat in the launched browser window, it does get marked as read in both browser and mobile. Is there anyway I can mark the chat as read in mobile as well, so that the messages don't get returned during the next run.
OS: Windows 10
Python: 3.7.9 64-bit
openwa: 1.3.16 (installed using pipenv)
Browser: Firefox using gecko driver
PS: I also tried "driver.chat_send_seen(msg.chat_id)", but that didn't help in marking the chat as read in mobile.
The text was updated successfully, but these errors were encountered:
I am trying to read unread messages using the below code. I did not get any messages with the default arguments for the 'get_unread' method. But by passing 'use_unread_count', I am able to get the list of unread messages. But one issue is, it doesn't mark these chat messages as 'read' in mobile (it does get marked as read in browser view). So, when I rerun below code, it again returns the older messages.
Instead of using the code, if I manually click a chat in the launched browser window, it does get marked as read in both browser and mobile. Is there anyway I can mark the chat as read in mobile as well, so that the messages don't get returned during the next run.
OS: Windows 10
Python: 3.7.9 64-bit
openwa: 1.3.16 (installed using pipenv)
Browser: Firefox using gecko driver
PS: I also tried "driver.chat_send_seen(msg.chat_id)", but that didn't help in marking the chat as read in mobile.
The text was updated successfully, but these errors were encountered: