Read Microsoft Teams messages using Graphs API
Explained the same in Youtube Video : https://youtu.be/Uez9QrBNNS0
So today I had a requirement to create a custom app where I can read all MS teams message and use AI to reply to the team’s messages.
The 1st thing we need is to get read all Messages in Microsoft Teams using a Graphs API. I tried to look for option and finally got a Teams Beta API named ‘messages (Without replies) in a channel’ but it needs GroupID and ChannelID to read to the messages.

So I ran below Graphs API to get all the Teams I am members of, here we will get the name and the ID of the Teams group as well.
https://graph.microsoft.com/v1.0/me/joinedTeams

Now we need to use the Group ID in below graphs query to get allchannels in that teams group.
https://graph.microsoft.com/beta/teams/{group-id-for-teams}/Allchannels/

Finally when we have both the Group ID and ChannelID, we will use below graphs API to get all the messages in the ChannelID.
Note: I am only able to see all the unread messages.
https://graph.microsoft.com/beta/teams/{group-id-for-teams}/channels/{channel-id}/messages

Below I am able to see all the same messages using GUI in teams
