I'm trying to send a message in Microsoft Teams Channel via Client credentials provider flow. But it gives the following error.
I've followed the documentation here.
POST /teams/{id}/channels/{id}/messages
This is how my API Permissions look like.
I'm not sure if we can send messages on the channel through the application. Because I don't want to send it via delegated way. Is there any way we can achieve this?
UPDATE:
This is how I'm generating the token.
Update 2: screenshot of the postman request.
Generally speaking, you missed "Bearer " in Authorization header.
But based on my test, although we add Group.ReadWrite.All
and Teamwork.Migrate.All
Application permission, it will still give 401 Unauthorized
error.
After a research, I find that the use case of Application mode is to Import third-party platform messages to Teams using Microsoft Graph.
See the examples here.
I'm afraid that we have to use delegated way to send messages to Teams channel.