Send message to personal Chat via Graph API
Send message to personal Chat via Graph API
Send message to personal Chat via Graph API
Re: Send message to personal Chat via Graph API
It is now possible to send messages to personal chat(1:1) or to group chat in Microsoft Teams using Microsoft Graph API. And yes, the messages will be displayed in the Teams application using Microsoft Graph API.
Please refer the "1:1 and group chat messages" section from the below microsoft documentation link:
[chatMessage resource type](https://learn.microsoft.com/en-us/graph/api/resources/chatmessage?view=graph-rest-beta)
Also, below is the graph API to send a message to any conversation you want using **Post** HTTP method :
***[https://graph.microsoft.com/beta/users/](https://graph.microsoft.com/beta/users/){user-id}/chats/{chat-id}/messages***
To fetch {user-id} and {chat-id}, please follow the below steps using **Get** HTTP method:
-
Fetch the user id of a logged-in user or user id of other user using below graph API's:
[https://graph.microsoft.com/v1.0/me](https://graph.microsoft.com/v1.0/me)
[https://graph.microsoft.com/v1.0/users](https://graph.microsoft.com/v1.0/users)
-
Fetch the conversation/chat id of a user:
[https://graph.microsoft.com/beta/me/chats](https://graph.microsoft.com/beta/me/chats)
[https://graph.microsoft.com/beta/users/](https://graph.microsoft.com/beta/users/){id}/chats
As of now, there is no graph API to reply to a personal chat but we can reply to any team's channel message using Microsoft Graph API.
Please refer the "1:1 and group chat messages" section from the below microsoft documentation link:
[chatMessage resource type](https://learn.microsoft.com/en-us/graph/api/resources/chatmessage?view=graph-rest-beta)
Also, below is the graph API to send a message to any conversation you want using **Post** HTTP method :
***[https://graph.microsoft.com/beta/users/](https://graph.microsoft.com/beta/users/){user-id}/chats/{chat-id}/messages***
To fetch {user-id} and {chat-id}, please follow the below steps using **Get** HTTP method:
-
Fetch the user id of a logged-in user or user id of other user using below graph API's:
[https://graph.microsoft.com/v1.0/me](https://graph.microsoft.com/v1.0/me)
[https://graph.microsoft.com/v1.0/users](https://graph.microsoft.com/v1.0/users)
-
Fetch the conversation/chat id of a user:
[https://graph.microsoft.com/beta/me/chats](https://graph.microsoft.com/beta/me/chats)
[https://graph.microsoft.com/beta/users/](https://graph.microsoft.com/beta/users/){id}/chats
As of now, there is no graph API to reply to a personal chat but we can reply to any team's channel message using Microsoft Graph API.