Send message to Teams user

Yan 11 Reputation points
2021-08-04T14:06:34.287+00:00

The situation is that in my application there are several users who want to contact their colleagues from Teams by sending messages from my application. Each of these users in my application should see their chats and messages, so user A should not see the conversation of user B.

Is there a way how to send such messages? Is it correct that to send a message on behalf of the particular user we need to use his username and password and different credentials when we send a message on behalf of another user?

Please assist can we log in as a user using Microsoft credentials to get access to username and password or what is the way?

Thank you in advance!

Microsoft Teams | Development
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. JosephXu-MSFT 531 Reputation points
    2021-08-05T08:18:33.077+00:00

    Hi @Yan .

    1. You should set a Delegated permission for your app. Let users login and your app can send chat message via Graph APIs on behalf of a user. You should add delegated permission ChatMessage.Send, Chat.ReadWrite.
    2. You can use ROPC flow which allows an application to sign in the user by directly handling their password.

  2. Prithvi-MSFT 271 Reputation points Microsoft External Staff
    2021-08-06T11:06:47.813+00:00

    Hi, Are you trying to send messages from your custom application to your colleagues who are using Microsoft Teams ?


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.