def get_channel_messages()

in ees_microsoft_teams/microsoft_teams_channels.py [0:0]


    def get_channel_messages(self, team_channels_list, ids_list, start_time, end_time):
        """ Fetches all the channel messages from the Microsoft Teams
            :param team_channels_list: List of dictionaries containing team_id as a key and
                channels of that team as a value
            :param ids_list: Shared storage for storing the document ids
            :param start_time: Starting time for fetching data
            :param end_time: Ending time for fetching data
            Returns:
                documents: List of dictionaries containing the channel messages details
        """
        self.logger.debug(
            f"Fetching channel messages for the interval of start time: {start_time} and end time: {end_time}.")
        documents = []
        for team_channel_map in team_channels_list:
            for team_id, channel_list in team_channel_map.items():
                for channel in channel_list:
                    channel_id = channel["id"]
                    channel_name = channel["title"]
                    self.logger.info(f"Fetching the channel messages for channel: {channel_name}")

                    response = self.client.get_channel_messages(
                        next_url=f"{constant.GRAPH_BASE_URL}/teams/{team_id}/channels/{channel_id}/messages",
                        channel_name=channel_name, start_time=start_time, end_time=end_time)

                    if response:
                        documents = self.get_channel_messages_documents(
                            response, channel, ids_list, team_id, start_time, end_time, documents)
        return documents