Forum Discussion
Using PowerApps "Send a Microsoft Graph HTTP request"
Hello
I am trying to send a activity to Teams activity feed.
The idea is to have a SharePoint list and if a new event or update event accurse on the SharePoint list to send a notification to Teams Activity.
I started with he following code but it was not working when I updated the TeamID:
Method: POST
URI: https://graph.microsoft.com/v1.0/teams/{teamId}/sendActivityNotification
HEADER: Content-Type: application/json
BODY:
{
"topic": {
"source": "entityUrl",
"value": "https://graph.microsoft.com/v1.0/teams/{teamId}"
},
"activityType": "systemDefault",
"previewText": {
"content": "Take a break"
},
"recipient": {
"@odata.type": "microsoft.graph.aadUserNotificationRecipient",
"userId": "569363e2-4e49-4661-87f2-16f245c5d66a"
},
"templateParameters": [
{
"name": "systemDefaultText",
"value": "You need to take a short break"
}
]
}
The idea is to trigger the flow by SharePoint event Update & new.
Then using the HTTP Request to Graph API and send an information with the URL of the new ITEM or FILE.
In the moment some user have issues to be informed by he activity feed and it works by others.
But the users who have issues get by other user informed. Its really a weird situation.
The users are creating in the SitePages library ASPX files and want to inform others about the updated and new pages.
Thanks in advance for the help.
Kind regards
Michael
Hello @Mikel2024,
You're on the right track using the sendActivityNotification endpoint, but there are a few important details and common pitfalls that can cause inconsistent delivery of activity feed notifications in Teams.To ensure your app can send activity notifications via Microsoft Teams, please make sure the following requirements are met:
- The app registration must have the TeamsActivity.Send application permission granted and admin consented in Azure Active Directory (Azure AD).
- The app must be installed in the target team and for the recipient user.
- The recipient must be a valid Azure AD user and a member of the team.
- The topic.value should be a valid entity URL, such as a channel or team. For team-wide notifications, you can use the following format:
https://graph.microsoft.com/v1.0/teams/{teamId} - If using a custom activityType, please ensure the corresponding template is defined and all required parameters are provided. Alternatively, you may use "systemDefault" for basic notifications.
- The Teams app (your app registration) must be installed for every user you intend to notify. You can use Microsoft Graph API to perform app installations for users, if necessary.
- Finally, please double-check that the userId is accurate and the user is a member of the team.
// POST https://graph.microsoft.com/v1.0/teams/{teamId}/sendActivityNotification { "topic": { "source": "entityUrl", "value": "https://graph.microsoft.com/v1.0/teams/{teamId}" }, "activityType": "systemDefault", "previewText": { "content": "A new or updated SharePoint page is available" }, "recipient": { "@odata.type": "microsoft.graph.aadUserNotificationRecipient", "userId": "569363e2-4e49-4661-87f2-16f245c5d66a" }, "templateParameters": [ { "name": "systemDefaultText", "value": "Check out the updated page: https://yourtenant.sharepoint.com/sites/yoursite/SitePages/yourpage.aspx" } ] }
Reference Document-
1. Send activity feed notifications to users in Microsoft Teams - Microsoft Graph | Microsoft Learn
2. Install app for user - Microsoft Graph v1.0 | Microsoft Learn
3 Replies
- Sayali-MSFT
Microsoft
Hello @Mikel2024,
You're on the right track using the sendActivityNotification endpoint, but there are a few important details and common pitfalls that can cause inconsistent delivery of activity feed notifications in Teams.To ensure your app can send activity notifications via Microsoft Teams, please make sure the following requirements are met:
- The app registration must have the TeamsActivity.Send application permission granted and admin consented in Azure Active Directory (Azure AD).
- The app must be installed in the target team and for the recipient user.
- The recipient must be a valid Azure AD user and a member of the team.
- The topic.value should be a valid entity URL, such as a channel or team. For team-wide notifications, you can use the following format:
https://graph.microsoft.com/v1.0/teams/{teamId} - If using a custom activityType, please ensure the corresponding template is defined and all required parameters are provided. Alternatively, you may use "systemDefault" for basic notifications.
- The Teams app (your app registration) must be installed for every user you intend to notify. You can use Microsoft Graph API to perform app installations for users, if necessary.
- Finally, please double-check that the userId is accurate and the user is a member of the team.
// POST https://graph.microsoft.com/v1.0/teams/{teamId}/sendActivityNotification { "topic": { "source": "entityUrl", "value": "https://graph.microsoft.com/v1.0/teams/{teamId}" }, "activityType": "systemDefault", "previewText": { "content": "A new or updated SharePoint page is available" }, "recipient": { "@odata.type": "microsoft.graph.aadUserNotificationRecipient", "userId": "569363e2-4e49-4661-87f2-16f245c5d66a" }, "templateParameters": [ { "name": "systemDefaultText", "value": "Check out the updated page: https://yourtenant.sharepoint.com/sites/yoursite/SitePages/yourpage.aspx" } ] }
Reference Document-
1. Send activity feed notifications to users in Microsoft Teams - Microsoft Graph | Microsoft Learn
2. Install app for user - Microsoft Graph v1.0 | Microsoft Learn
- Sayali-MSFT
Microsoft
Hello @Mikel2024,
Glad to hear that your issue is resolved!!
We would appreciate it if you could share your valuable feedback via the Microsoft Teams Developer Community Response Feedback link?
- Sayali-MSFT
Microsoft
Hello @Mikel2024,
Thank you for your inquiry about your Teams app development issue!
We are checking the issue. We will get back to you shortly.