How to send message to created Chat using oneonOne type

Ranjith Kumar Jain 20 Reputation points
2024-05-15T05:13:01.0666667+00:00

Hi

I created a chat id using https://graph.microsoft.com/v1.0/chats

chat id created : 19:442a30f7-833a-485d-8cf7-f263e3d85725_8bbdd8cb-5843-44a0-bd29-602228e8aa39@unq.gbl.spaces

Then trying to send message to this chat using POST request

https://graph.microsoft.com/v1.0/chats/19:7a4bd82d-51e7-46dd-b134-a525e6a91e85_8bbdd8cb-5843-44a0-bd29-602228e8aa39@unq.gbl.spaces/messages


    "error": {
        "code": "Unauthorized",
        "message": "Message POST is allowed in application-only context only for import purposes. Refer to https://docs.microsoft.com/microsoftteams/platform/graph-api/import-messages/import-external-messages-to-teams for more details.",
        "innerError": {
            "date": "2024-05-15T05:10:50",
            "request-id": "27f6faf6-9ac0-436f-9e89-96b3f4ed758f",
            "client-request-id": "27f6faf6-9ac0-436f-9e89-96b3f4ed758f"
        }
    }
}
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,874 questions
0 comments No comments
{count} votes

Accepted answer
  1. CarlZhao-MSFT 37,871 Reputation points
    2024-05-15T05:50:31.38+00:00

    Hi @Ranjith Kumar Jain

    The application context can only import third-party messages, but cannot send messages. You should use delegated permissions and create a delegated context to send messages.

    User's image

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful