“The email reminders don’t really work for me, is there maybe a way to trigger the Approval follow up in Teams with Power Automate flow?”
Recently, Matthew Devaney wrote multiple blog posts on the approvals API in Teams – cancelling task, reassigning task, etc. That got me thinking. It’s all useful, but what about one of the most annoying thing with the approval flow: reminders. Maybe the approvals API has a solution for that too! Every task in Teams has the ‘follow up’ button, can a flow trigger it?
Analysing the request
When you’re trying to replicate a functionality, it’s very helpful if you can do it in a browser. I did it with the solution to copy existing lists, and you can do the same with the approval follow up button.
Open Teams in a browser with the developer console. Click the follow up button and check the network in the console, you’ll see it’s sending a ‘sendReminder’ request.
Checking details of the request you’ll learn two important things. Firstly, the URL it’s calling:
https://approvals.teams.microsoft.com/api/sendReminder
Secondly, the body of the request.
That’s all you need for an attempt to replicate it from a flow via an HTTP request!
Replicating the request
The easiest way to replicate the HTTP request is with the ‘HTTP with Microsoft Entra ID’ action. You enter the endpoint, authenticate the connection, and you can start sending requests. Use the base resource as below:
https://approvals.teams.microsoft.com
As seen in the developer console, it’s a POST request to the /api/sendReminder endpoint.
The tricky part comes with the request body – you don’t need the whole body, but you need these 5 properties.
{
"ApprovalId":"<row id in the Approval Dataverse table>",
"PendingApprovers": ["<array with id's of the assigned users - both Entra AD id and id from User Dataverse table work>"],
"Title": "<task title>",
"Requester": "<requestor name / id>",
"FlowEnvironment": "<task environment id>"
}
You could search for all the pieces in the tables to run the request, but let’s integrate it in a flow.
Integrate it in a flow
When you build a reminder, you don’t want to search for any id’s manually. You want the flow to work on regular basis, remind the users automatically.
My reminders look always the same – I add additional columns to the request where I store the task assignment date and assignees. After that it’s a scheduled flow running once a day, reminding the users, ideally in a single email.
Since in this solution I’m working with Dataverse tables, I’ll make my life a bit easier – I’ll store also the Approval task Id and Approvers Id (as a semicolon separated string) in a separate column.
Now, with all the available information, I can move to the reminder flow. Find the request for the reminder and get the ApprovalId and the approvers. Use the ApprovalId to find the corresponding row in the Approvals Dataverse table.
This action is needed only because I don’t want to add separate columns also for the task title and requestor. You need a premium license anyway so one extra request to Dataverse won’t hurt.
With that you have everything you need for the reminder. ApprovalId and Approvers are stored in the request. Title and Requester can be taken from the Dataverse row. The environment id is available with the standard expression.
{
"ApprovalId":"@{outputs('Get_item')?['body/ApprovalId']}",
"PendingApprovers": @{split(outputs('Get_item')?['body/AssignedTo'],';')},
"Title": "@{outputs('Get_a_row_by_ID')?['body/msdyn_flow_approval_title']}",
"Requester": "@{outputs('Get_a_row_by_ID')?['body/_ownerid_value']}",
"FlowEnvironment": "@{workflow()?['tags']['environmentName']}"
}
That’s it, if you run the flow it’ll send a Teams follow up for the request.
Summary
Sending useful reminders is one of the bigger challenges when building approval flows. Users get just one email and a Teams notification where they can complete the task directly, after that it’s just information emails…
…unless you replicate the follow up functionality in a Power Automate flow and remind each approval. It’s still not the full reminder, it doesn’t resend the email with buttons, but if you’re using Teams in your organisation it might be a great addition!
Great work Tom. Together we will unlock all the secrets of the Power Automate approvals API. We can have alot of fun inspecting the network traffic in Chrome.
Hi Tom
Great idea. There’s another one of these buttons I’ve also seen people searching for: PDF the Approval.
If the HTTP request could also handle that, that would make so much more sense than any workaround!
Just an idea … I might also use it in the future 🙂
Thanks,
Christine
great article, but i am unable to create the connection. it fails with this error. thoughts?
Failed with error: ‘AADSTS65002: Consent between first party application ‘d2ebd3a9-1ada-4480-8b2d-eac162716601’ and first party resource ‘3e050dd7-7815-46a0-8263-b73168a42c10’ must be configured via preauthorization – applications owned and operated by Microsoft must get approval from the API owner before requesting tokens for that API. Trace ID: b90138cb-d7b1-46d6-adf6-d0057bcc7b00 Correlation ID: cb14f88d-d278-4c1d-b03f-3f0dcc9a872a Timestamp: 2024-08-26 12:52:21Z ‘. Please sign in again or choose another connection.