-
Notifications
You must be signed in to change notification settings - Fork 533
Description
Steps to reproduce
Send chat using POST /chats/{chat-id}/messages in app permissions with Teamwork.Migrate.All following : https://learn.microsoft.com/en-us/microsoftteams/platform/graph-api/import-messages/import-external-messages-to-teams
My payload (created date in the past) :
{
"body": {
"content": "test123",
"contentType": "text"
},
"createdDateTime": "2025-12-08T21:42:31.7049935+00:00",
"from": {
"@odata.type": "#microsoft.graph.chatMessageFromIdentitySet",
"user": {
"id": "87f6e2ff-da35-4e36-9dab-f50d8e1a73a6",
"@odata.type": "#microsoft.graph.teamworkUserIdentity",
"userIdentityType": "aadUser"
}
}
}
Expected behavior
Looking at teams channel messages with the Teamwork.Migrate.All, I'm assuming I was able to import into chats as well seeing that same permission on the send chat message. Anything I try whether I try to create a chat in import mode or use a normal chat, I can never do it. The article about importing external messages into teams does not mention private chats, but the doc mentions the Teamwork.Migrate.All app permission so how do I send messages in app permissions to a chat?
Actual behavior
Bad gateway error when try to send a message using Teamwork.Migrate.All permission :
{
"error": {
"code": "BadGateway",
"message": "Failed to execute backend request.",
"innerError": {
"code": "1",
"date": "2025-12-09T21:42:31",
"request-id": "ab225512-77a3-4a27-861a-e3d071339bf2",
"client-request-id": "4b0b55e2-7708-4ef8-ba50-6b63bdcd8d2a"
}
}
}
And when trying to create the chat in migration mode :
{
"error": {
"code": "BadRequest",
"message": "OperationFailed",
"innerError": {
"code": "1",
"message": "Threadtype [chat] is not allowed to be imported",
"date": "2025-12-09T21:38:33",
"request-id": "34381509-3db5-47a9-92c6-880bd0283dd1",
"client-request-id": "35006125-171e-4b9e-b730-affef15e5473"
}
}
}
Error details
Im not sure if I am doing something wrong or chats do not really support migration mode, in that case, we should remove the Teamwork.Migration.All permission from the doc.
Update :
If I remove the from property I even get an error mentioning the external messages import article which seems to indicate it is possible :
{
"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-12-09T21:56:35",
"request-id": "ae2da542-f89f-402a-bca8-d6df3b1f707a",
"client-request-id": "4b0b55e2-7708-4ef8-ba50-6b63bdcd8d2a"
}
}
}