According to the graph API (https://docs.microsoft.com/en-us/graph/api/chat-post-messages), this is the form for POSTing a chat message.
POST https://graph.microsoft.com/v1.0/chats/19:2da4c29f6d7041eca70b638b43d45437@thread.v2/messages
Content-type: application/json
{
"body": {
"content": "Hello world"
}
}
However, when I make the following fetch request, the returned JSON indicates the body is malformed. Exact ID & token redacted.
fetch("https://graph.microsoft.com/v1.0/chats/{CHAT-ID}/messages",
{
method: "POST",
headers: {
"Authorization": "Bearer {ACCESS-TOKEN}",
"Host": "graph.microsoft.com",
"Content-Type": "application/json"
},
body: JSON.stringify({ "content": "Message" })
})
.then(response => response.json())
.then(res => {
console.log(res);
})
{
error: {
code: 'BadRequest',
message: 'Missing body content',
...
Thanks for any help!