Forum Discussion
SudhishSoman
Mar 13, 2023Copper Contributor
Using Application Authentication for Sending Messages to Teams Channel
Hello everyone,
I'm currently working on a C# application that needs to send messages to a Teams channel. I was wondering if it's possible to use application authentication to achieve this? If so, could anyone please share some sample code or documentation on how to do this?
Thank you in advance for your help.
- Nivedipa-MSFTMicrosoft
SudhishSoman - Using application permission you can send the message in channel using following API:
POST /teams/{team-id}/channels/{channel-id}/messages
but application permissions are only supported for migration.
Ref Doc: Send chatMessage in a channel or a chat - Microsoft Graph v1.0 | Microsoft Learn- SudhishSomanCopper ContributorHi,
Thank you for your response to my previous message regarding sending messages to a Teams channel using C# code. I tried using the API endpoint you suggested with application authentication, but it showed an error stating that POST messages are only allowed in application-only context for import purposes.
Additionally, I also tried delegated authentication which always required user interaction to generate a token.
Thank you again for your assistance in this matter.- Nivedipa-MSFTMicrosoftSudhishSoman - You can use the above-mentioned graph API only in migration not general purpose.