From 5d5135ffec50928b098440f28c7e968f2340545a Mon Sep 17 00:00:00 2001 From: rafaelcalassara Date: Fri, 3 Jan 2025 23:07:14 -0300 Subject: [PATCH] feat: enhance get_messages method to support pagination with page and offset parameters --- evolutionapi/services/chat.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/evolutionapi/services/chat.py b/evolutionapi/services/chat.py index b5d4350..d4d3291 100644 --- a/evolutionapi/services/chat.py +++ b/evolutionapi/services/chat.py @@ -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,