Forum Discussion
Pratapkarn2186
Sep 19, 2022Copper Contributor
Notifications with sendActivityNotification API
Hi All, I am using sendActivityNotification API to send activity feed notifications to a user. Sometimes API works fine and multiple times it gives errors related to " Specified activity wi...
Sayali-MSFT
Microsoft
Sep 21, 2022
Pratapkarn2186 - Can you share the request and response for the API you are calling along with headers. You can skip access token information and also share the manifest.
Pratapkarn2186
Sep 22, 2022Copper Contributor
Hi sayali-MST, please find the details.
Request : https://graph.microsoft.com/v1.0/users/email address removed for privacy reasons/teamwork/sendActivityNotification --header 'Authorization: XXXXXXX' --header 'Content-Type: application/json' --header 'Accept: application/json'
Data : {"topic":{"source":"text","value":"New message","WebUrl":"https://teams.microsoft.com/l/entity/XXXX/YYY"},"activityType":"mldt_notify","previewText":{"content":"Check New Messaging"}}
Request : https://graph.microsoft.com/v1.0/users/email address removed for privacy reasons/teamwork/sendActivityNotification --header 'Authorization: XXXXXXX' --header 'Content-Type: application/json' --header 'Accept: application/json'
Data : {"topic":{"source":"text","value":"New message","WebUrl":"https://teams.microsoft.com/l/entity/XXXX/YYY"},"activityType":"mldt_notify","previewText":{"content":"Check New Messaging"}}
- Pratapkarn2186Sep 24, 2022Copper Contributor
Another observation API sometimes works and randomly gives below gives :
Application with AAD App Id 'XXXXXX' is not authorized to generate custom text notifications about '/v1.0/users/XXXXXX/teamwork/Microsoft.Teams.GraphSvc.sendActivityNotification' to the recipient. Ensure that the expected Teams app is installed in the target scope (user, team, or chat).- Sayali-MSFTSep 26, 2022
Microsoft
Pratapkarn2186 - Could you please create a new app and install the app in relevant scope (teams or group chat) to make the API work.
Also the API requires few application level permissions to work.
While testing it using Graph Explorer, it will create its own app id that is not related to actual app, that's why it is causing forbidden error. Could you please try to test your API using Postman tool.- Pratapkarn2186Sep 26, 2022Copper Contributor
The app is published in personal scope, then I search for the application and just add.
I don't see any option for scope, but it says "works in Teams"
Is something else that needs to be done ??