I have written a script that uses Graph API and PowerShell to extract the messages and replies in every channel in a Microsoft Teams team. In these GDPR days, I would do some research on what’s allowed in your country regarding data storage, before thinking about using this with real-world data. You can see an example of output from my demo tenant here:
Because the script contains HTML code, I could not embed the code here on my blog. I had to post it on GitHub, so if you head over here, you can copy the script.