How to develop an MS teams bot with oauth app using graph api

Chris Morris 0 Reputation points
2024-11-20T19:28:44.2466667+00:00

I have setup a small App Registration to work with the Graph API along side MS Teams. It uses the oauth flow to receive an access code, which I then can exchange for a token. I am successfully able to exchange the token for a "bot" token but then receive an error when attempting to send a message to a specific ms teams channel. I have tried the following endpoints using my service url:

  • constructing a conversation reference and sending a request to the v3/conversations/{conversation_id} endpoint but receive {"message":"Authorization has been denied for this request."}
  • constructing a new activity and sending a request to v3/conversations/{conversation_id}/activities but receive {"message":"Authorization has been denied for this request."}
  • attempting to create a new conversation first, also receiving the same error message

I have also added an app to my teams instance and into that channel. I have also inspected the JWT token which includes the necessary TeamWork.Migrate.All . My app also includes numerous application permissions which appear in the JWT. I'm looking for any guidance on what might be missing.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,369 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,951 questions
0 comments No comments
{count} votes

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.