can not use API send chat with teams

Suryadi Uganda 0 Reputation points
2025-03-24T09:34:23.4866667+00:00

{"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":"2025-03-24T09:23:35","request-id":"bbe089bf-b515-4a0c-8be4-580137ddf39d","client-request-id":"bbe089bf-b515-4a0c-8be4-580137ddf39d"}}}

I got this error when try using API to send chat in teams

if i have to subscribe something in microsoft to enable API send chat with teams,

which subject or title of subsribe ?

and which permissions i have to enabled in microsoft graph , I think I have enables all needed ?

i don't want use delegate concept, due to I want to build API in my system to send report to our colleague

Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,838 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Prasad-MSFT 8,846 Reputation points Microsoft External Staff
    2025-03-24T11:30:20.75+00:00

    Hi Suryadi Uganda, thanks for raising your issue.
    According to this documentation, Application permissions are only supported for migration.
    Ref: https://learn.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-1.0&tabs=http#permissions-for-channel


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.