From 37320e247b65164bdcf764336175d63f38096536 Mon Sep 17 00:00:00 2001 From: rafaelcalassara Date: Fri, 3 Jan 2025 21:55:27 -0300 Subject: [PATCH] feat: add get_messages method to retrieve chat messages by remote JID --- evolutionapi/services/chat.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/evolutionapi/services/chat.py b/evolutionapi/services/chat.py index b2af456..b5d4350 100644 --- a/evolutionapi/services/chat.py +++ b/evolutionapi/services/chat.py @@ -66,4 +66,13 @@ class ChatService: f'chat/sendPresence/{instance_id}', data=data.__dict__, instance_token=instance_token - ) \ No newline at end of file + ) + + def get_messages(self, instance_id: str, remote_jid: str, instance_token: str): + '''Get messages from a chat''' + payload = {"where": {"key": {"remoteJid": remote_jid}}} + return self.client.post( + f'chat/findMessages/{instance_id}', + data=payload, + instance_token=instance_token, + )