403 error while accessing Teams chat using graph API

Sreeni Raghavan 0 Reputation points
2025-01-20T11:00:27.6633333+00:00

We are trying to extract MS Teams chat messages for various users and channels using Graph API. We are using application credentials attached in the screenshot.

Application permissions.png

While accessing Graph API, many chats are getting read. But, we are also getting multiple errors like "Error: 403 Client Error: Forbidden for url: https:// graph.microsoft.com/v1.0/chats/19%3Ac10c62d2987a4df4ad7fade9feafa1f2%40thread.v2/messages". We are not sure if this is an error while accessing particular user's chat messages or individual messages within a chat session. Any ideas?

Teams Error.png

Microsoft Security Microsoft Graph
Microsoft Teams Microsoft Teams for business Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Akhil Nasalwai - MSFT 1,685 Reputation points Microsoft External Staff
    2025-01-21T01:57:31.5433333+00:00

    Hello Sreeni Raghavan,

    Thank you for contacting Microsoft!

    Regarding the error for getting chats using Graph API, 403 client error indicates the issue seems to be with permissions.

    Ensure that your application has the correct permissions as per the documentation. Also please verify these permissions are granted and consented to by an admin. Since sometimes changes to permissions require re-consenting.

    Ensure that the scope of the permissions matches the API calls you are making.

    Ensure that the access token you are using is valid and has not expired. You can use tools like jwt.ms to decode and inspect your token.

    Even after verifying the above, if the issue still persists, I recommend you to raise a support case with Microsoft Graph, a Support Engineer will be able to look into this issue and assist you better. You can raise support ticket from New support request - Microsoft Entra admin center or https://admin.microsoft.com/#/support/requests.

    Hope this helps.

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

    0 comments No comments

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.