Get Started - Learn How To Make Your Bot!
List of all currently Free Items
Added on version 23.1.0b13
get_conversations(self, not_joined: bool = False, last_id: str | None = None) -> GetConversationsRequest.GetConversationsResponse | Error:
Fetch the conversations for the bot.
This will return list of conversations opened with bot, there are two types of conversations, the ones bot has joined and unjoined. If not_joined
is set to True then only unjoined conversations will be returned, otherwise only joined conversations will be returned. Response will also return number of unjoined conversations that bot has. This method will return at most 20 conversations ordered from newest to the oldest, If last_id
is provided then only conversations that are older than specified id will be returned.
Here we will use the get_conversations method to retrieve all of the bot’s conversations and store it in a variable called conversations and then we will print it on terminal to see how the response from it looks like.
async def on_start(self, session_metadata: SessionMetadata) -> None:
conversations = await self.highrise.get_conversations()
print (conversations)
Response:
GetConversationsRequest.GetConversationsResponse(
conversations=[
Conversation(
id='1_on_1:6111e1fb22dcb50edf32e4a8:649b87f63cf84acc47487627',
did_join=True, unread_count=0,
last_message=Message(
message_id='64b0a27dfd1c588666bd2f00',
conversation_id='1_on_1:6111e1fb22dcb50edf32e4a8:649b87f63cf84acc47487627',
createdAt=datetime.datetime(2023, 7, 14, 1, 18, 53),
content='Hello World!',
sender_id='649b87f63cf84acc47487627',
category='text'),
muted=False,
member_ids=['6111e1fb22dcb50edf32e4a8', '649b87f63cf84acc47487627'],
name=None, owner_id=None)], not_joined=0, rid='0')