Share via

Can we use Microsoft Graph API to extract messages from a Meeting chat ??

Nanda Kishore 0 Reputation points
Dec 20, 2023, 2:29 AM

I'm looking for options to extract all the messages from a group chat which is 2 year old. Im trying to create a dataset for a AI bot out that chat group.

My question is there a way that I can extract messages from a "Meeting chat"?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,310 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Diah.Karim-MSFT 330 Reputation points Microsoft External Staff
    Dec 20, 2023, 5:12 AM

    Hi Nanda,

    Yes, actually you can extract all the messages from a group chat & channel.

    You can refer to this article https://learn.microsoft.com/en-us/graph/api/chatmessage-get?view=graph-rest-1.0&tabs=http. The messages can be extracted by using Ms Graph SDK, MS Graph Powershell or Ms Graph Explorer (use this for testing)

    Here is an example to retrieve messages from channels

    Steps:

    1. Open this link from browser https://developer.microsoft.com/en-us/graph/graph-explorer and sign-in using your m365 account
    2. Put this address https://graph.microsoft.com/v1.0/teams to the textbox and you may need to grant permission Team.ReadBasic.All from "Modify Permission" tab. Go run query and fetch the Id
    3. Replace the value in textbox with next calling to endpoint, https://graph.microsoft.com/v1.0/teams/{put team Id here}/channels and grant permission Channel.ReadBasic.All from "Modify Permission" tab. Go run query and fetch the Id
    4. Next, again replace the value in textbox with next calling to endpoint, https://graph.microsoft.com/v1.0/teams/{put team Id here}/channels/{put channel Id here}/messages and grant permission ChannelMessage.Read.All from "Modify Permission" tab. Go run query and you will get the message as below

    sampleChat

    sample1

    1. And to get the replied message, replace the value in textbox with next calling to endpoint https://graph.microsoft.com/v1.0/teams/{put team Id here}/channels/{put channel Id here}/messages/{put message Id here}/replies

    Go run query and you will get the message as below

    sample2

    Hope this helps.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.