Unable to send notification to teams installed application (chat)
When I tried to call the interface, an error message appeared as follows:
Interface information:
payload:
{
“topic”: {
“source”: “entityUrl”,
“value”: “https://graph.microsoft.com/v1.0/chats/19:email address removed for privacy reasons.spaces“
},
“activityType”: “taskCreated”,
“previewText”: {
“content”: “New Task Created”
},
“recipient”: {
“@odata.type”: “microsoft.graph.aadUserNotificationRecipient”,
“userId”: “f80482f7-ad6c-487a-aa67-c84539b487e1”
},
“templateParameters”: [
{
“name”: “taskId”,
“value”: “Task 12322”
}
]
}
Error message:
{
“error”: {
“code”: “Forbidden”,
“message”: “Application with AAD App Id ‘6c67b54d-866d-4405-876a-0d99323a0e86’ is not authorized to generate notifications about ‘https://graph.microsoft.com/v1.0/chats/19:email address removed for privacy reasons.spaces‘ to the recipient. Ensure that the expected Teams app is installed in the target scope (user, team, or chat).”,
“innerError”: {
“date”: “2024-05-29T07:03:26”,
“request-id”: “5350c32f-5f62-400c-9970-6ca8b5d47c88”,
“client-request-id”: “5350c32f-5f62-400c-9970-6ca8b5d47c88”
}
}
}
manifest file as follow:
{
“$schema”: “https://developer.microsoft.com/en-us/json-schemas/teams/v1.17/MicrosoftTeams.schema.json”,
“version”: “1.0.1”,
“manifestVersion”: “1.17”,
“id”: “26d59d9a-fce9-4640-b553-e0f07971381e”,
“name”: {
“short”: “notice”,
“full”: “notice”
},
“developer”: {
“name”: “notice”,
“mpnId”: “”,
“websiteUrl”: “https://localhost/test”,
“privacyUrl”: “https://localhost/test”,
“termsOfUseUrl”: “https://localhost/test”
},
“description”: {
“short”: “notice”,
“full”: “notice”
},
“icons”: {
“outline”: “outline.png”,
“color”: “color.png”
},
“accentColor”: “#FFFFFF”,
“staticTabs”: [
{
“entityId”: “index0”,
“name”: “Personal Tab”,
“contentUrl”: “https://localhost/test”,
“websiteUrl”: “https://localhost/test”,
“scopes”: [
“personal”
]
}
],
“validDomains”: [
“localhost”
],
“webApplicationInfo”: {
“id”: “6c67b54d-866d-4405-876a-0d99323a0e86”
},
“activities”: {
“activityTypes”: [
{
“type”: “taskCreated”,
“description”: “Task Created Activity”,
“templateText”: “{actor} created task {taskId} for you”
},
{
“type”: “approvalRequired”,
“description”: “Deployment requires your approval”,
“templateText”: “{actor} created a new deployment {deploymentId}”
}
]
},
“authorization”: {
“permissions”: {
“resourceSpecific”: [
{
“name”: “TeamsActivity.Send.User”,
“type”: “Application”
},
{
“name”: “TeamsActivity.Send.Group”,
“type”: “Application”
},
{
“name”: “TeamsActivity.Send.Chat”,
“type”: “Application”
}
]
}
}
}
When I tried to call the interface, an error message appeared as follows:Interface information:https://graph.microsoft.com/v1.0/chats/19:email address removed for privacy reasons.spaces/sendActivityNotificationpayload:{“topic”: {“source”: “entityUrl”,”value”: “https://graph.microsoft.com/v1.0/chats/19:email address removed for privacy reasons.spaces”},”activityType”: “taskCreated”,”previewText”: {“content”: “New Task Created”},”recipient”: {“@odata.type”: “microsoft.graph.aadUserNotificationRecipient”,”userId”: “f80482f7-ad6c-487a-aa67-c84539b487e1″},”templateParameters”: [{“name”: “taskId”,”value”: “Task 12322”}]}Error message:{“error”: {“code”: “Forbidden”,”message”: “Application with AAD App Id ‘6c67b54d-866d-4405-876a-0d99323a0e86’ is not authorized to generate notifications about ‘https://graph.microsoft.com/v1.0/chats/19:email address removed for privacy reasons.spaces’ to the recipient. Ensure that the expected Teams app is installed in the target scope (user, team, or chat).”,”innerError”: {“date”: “2024-05-29T07:03:26″,”request-id”: “5350c32f-5f62-400c-9970-6ca8b5d47c88″,”client-request-id”: “5350c32f-5f62-400c-9970-6ca8b5d47c88”}}}manifest file as follow: {
“$schema”: “https://developer.microsoft.com/en-us/json-schemas/teams/v1.17/MicrosoftTeams.schema.json”,
“version”: “1.0.1”,
“manifestVersion”: “1.17”,
“id”: “26d59d9a-fce9-4640-b553-e0f07971381e”,
“name”: {
“short”: “notice”,
“full”: “notice”
},
“developer”: {
“name”: “notice”,
“mpnId”: “”,
“websiteUrl”: “https://localhost/test”,
“privacyUrl”: “https://localhost/test”,
“termsOfUseUrl”: “https://localhost/test”
},
“description”: {
“short”: “notice”,
“full”: “notice”
},
“icons”: {
“outline”: “outline.png”,
“color”: “color.png”
},
“accentColor”: “#FFFFFF”,
“staticTabs”: [
{
“entityId”: “index0”,
“name”: “Personal Tab”,
“contentUrl”: “https://localhost/test”,
“websiteUrl”: “https://localhost/test”,
“scopes”: [
“personal”
]
}
],
“validDomains”: [
“localhost”
],
“webApplicationInfo”: {
“id”: “6c67b54d-866d-4405-876a-0d99323a0e86”
},
“activities”: {
“activityTypes”: [
{
“type”: “taskCreated”,
“description”: “Task Created Activity”,
“templateText”: “{actor} created task {taskId} for you”
},
{
“type”: “approvalRequired”,
“description”: “Deployment requires your approval”,
“templateText”: “{actor} created a new deployment {deploymentId}”
}
]
},
“authorization”: {
“permissions”: {
“resourceSpecific”: [
{
“name”: “TeamsActivity.Send.User”,
“type”: “Application”
},
{
“name”: “TeamsActivity.Send.Group”,
“type”: “Application”
},
{
“name”: “TeamsActivity.Send.Chat”,
“type”: “Application”
}
]
}
}
} @MicrosoftTeams Read More