in ees_microsoft_teams/microsoft_teams_channels.py [0:0]
def get_message_replies(self, team_id, channel_id, message_id, start_time, end_time):
""" Fetches the replies of a specific channel message.
:param team_id: Team id
:param channel_id: Channel id
:param message_id: Parent message id
:param start_time: Starting time for fetching data
:param end_time: Ending time for fetching data
Returns:
message_body: List of message replies
"""
self.logger.info(f"Fetching message replies for message id: {message_id}...")
replies_list = []
replies_url = f"{constant.GRAPH_BASE_URL}/teams/{team_id}/channels/{channel_id}/messages/{message_id}/replies"
response = self.client.get_channel_messages(
next_url=replies_url,
start_time=start_time,
end_time=end_time,
is_message_replies=True
)
parsed_response = get_data_from_http_response(
logger=self.logger,
response=response,
error_message="Could not fetch the channel message replies.",
exception_message="Error while fetching the channel message replies."
)
if not parsed_response:
return ""
for reply in parsed_response:
reply_content = html_to_text(self.logger, reply["body"]["content"])
if reply_content:
sender = reply["from"]["user"]["displayName"]
replies_list.append(f"{sender} - {reply_content}")
message_body = "\n".join(reply for reply in replies_list)
return message_body