aikadakh
aikadakh

Reputation: 67

Unknown Error when sending/replying to message on MS Teams using Graph API

I am trying to send a message or reply to a message using Graph APIs for MS Teams. I have the correct permissions set and also have access to Protected APIs (if thats a concern). The APIs I use to send messages are for both channel and 1:1 chat message.

POST URL Request:

https://graph.microsoft.com/beta/chats/{chat-id}/messages/{message-id}/replies
https://graph.microsoft.com/beta/chats/{chat-id}/messages/
https://graph.microsoft.com/beta/users/{user-id}/chats/{chat-id}/messages/
https://graph.microsoft.com/beta/teams/{team-id}/channels/{channel-id}/messages/{message-id}/replies
https://graph.microsoft.com/beta/teams/{team-id}/channels/{channel-id}/messages

Permissions set are ChannelMessage.Send, Group.ReadWrite.All, ChatMessage.Send for both delegated and application level.

I use a 2-step process to authorize the client /authorize and then /adminconsent.

When trying to post message I always get "UnknownError" and empty message with 401 status code.

{
  "error": {
    "code": "UnknownError",
    "message": "",
    "innerError": {
      "date": "2020-07-10T04:58:06",
      "request-id": "ff58128b-585b-4242-99c4-011c8e537d94"
    }
  }
}

Is this some issue with my app or from MS graph side?

Upvotes: 0

Views: 508

Answers (1)

Wajeed Shaikh
Wajeed Shaikh

Reputation: 3158

Issue was with the access token. Using app-only permissions to send message is not supported.

Ref: https://github.com/microsoftgraph/microsoft-graph-docs/issues/8998

Upvotes: 1

Related Questions