feat: enhance get_messages method to support pagination with page and offset parameters

This commit is contained in:
rafaelcalassara 2025-01-03 23:07:14 -03:00
parent 40ab492eac
commit 5d5135ffec

View File

@ -68,9 +68,13 @@ class ChatService:
instance_token=instance_token
)
def get_messages(self, instance_id: str, remote_jid: str, instance_token: str):
def get_messages(self, instance_id: str, remote_jid: str, instance_token: str, page: int = 1, offset: int = 50):
'''Get messages from a chat'''
payload = {"where": {"key": {"remoteJid": remote_jid}}}
payload = {
"where": {"key": {"remoteJid": remote_jid}},
"page": page,
"offset": offset,
}
return self.client.post(
f'chat/findMessages/{instance_id}',
data=payload,