Merge pull request #5 from rafacalassara/add_get_messages

Add get messages
This commit is contained in:
Davidson Gomes 2025-01-06 12:22:51 -03:00 committed by GitHub
commit 69112cd4c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 1 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Python-generated files
__pycache__/
*.cpython*.pyc

View File

@ -66,4 +66,17 @@ class ChatService:
f'chat/sendPresence/{instance_id}',
data=data.__dict__,
instance_token=instance_token
)
)
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,
)