diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bd9a7b1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Python-generated files +__pycache__/ +*.cpython*.pyc \ No newline at end of file diff --git a/evolutionapi/services/chat.py b/evolutionapi/services/chat.py index b2af456..d4d3291 100644 --- a/evolutionapi/services/chat.py +++ b/evolutionapi/services/chat.py @@ -66,4 +66,17 @@ 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, page: int = 1, offset: int = 50): + '''Get messages from a chat''' + payload = { + "where": {"key": {"remoteJid": remote_jid}}, + "page": page, + "offset": offset, + } + return self.client.post( + f'chat/findMessages/{instance_id}', + data=payload, + instance_token=instance_token, + )