1
votes

I was just trying to access the Send chatMessage in a channel or a chat using the microsoft grah API. Also given the required permissions for the for my application both Delegant & Application level.

API Used : POST https://graph.microsoft.com/v1.0/teams/fbe2bf47-16c8-47cf-b4a5-4b9b187c508b/channels/19:[email protected]/messages

Content-type: application/json

{

"body": { "content": "Hello World" }

}

Postman Response: 401

{

"error": {

    "code": "Unauthorized",

    "message": "Unauthorized",

    "innerError": {

        "date": "2021-07-16T16:34:49",

        "request-id": "ddd9c7ad-f84b-423f-88fc-630330bad600",

        "client-request-id": "ddd9c7ad-f84b-423f-88fc-630330bad600"

    }

}

}

Graph API Explorer Response : 403

Documentation URL : https://docs.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-1.0&tabs=http

Thanks in Advance.

1
Probably an issue with the bearer token - either not provided or wrong audience. Show how you are constructing that POSt to the graph API and explain how you get the token and include it. - Josh
To send a chat Message, you should add the ChatMessage.Send permission, see here: docs.microsoft.com/en-us/graph/api/… - Diana
@Venu Kishore, Are u still stuck with this issue? - Hunaid Hanfee-MSFT

1 Answers

0
votes

I tried this using graph explorer and I was able to send the message.

enter image description here

enter image description here

Note : Please make sure you have the above required permissions to send the message to the channel.

enter image description here

Reference:

Send chatMessage in a channel or a chat - Microsoft Graph v1.0 | Microsoft Docs