Register response from custom Adaptive Cards sent from Power Automate to Teams
Table of contents:
Today Audrie Gordon Senior Program Manager for Power Automate organized webinar where she announced new changes to the integration between Power Automate and Microsoft Teams when talking about Adaptive Cards.
Features she was presenting are a long awaited functionalities we all were missing very much and which really fill the gap in business processes that are being created using Adaptive Cards and a no-code approach.
Important! Features announced and described in this post will be available early February as experimental/ preview features.
What were we missing?
Imagine, you would like to post an Adaptive Card from Power Automate that you want to use to register Teams channel members responses. Ex. to ask them to sign up for a conference. Or to response to a message from other system. Or to assign a custom task, not from Flow Approvals.
Until today the only kind of action in Adaptive Cards you were be able to handle was “GET”. But all the “POST” calls were never sent back to the Flow that created those cards. Instead, user was displayed an error saying: “Unable to reach app. Please try again.“
However, no matter how many times user would try again, nothing was changing. The situation was caused by the architecture – Adaptive Cards don’t have any configuration allowing designer to define target URL, where data from a form should be sent. This is because, the data is sent back to the app that generated them, in case of Microsoft Teams this is Flow Bot. After the data is sent, that app is responsible for handling it and triggering actual action. If you write your own bot, that will post Adaptive Cards to Teams, you are free to code how such actions should be handled. In case of the Flow Bot there was no way to get that response back to Power Automate. Until today!
What is the new feature?
This! Watch the screencast:
The new feature allows you to send custom card from Power Automate to Microsoft Teams and then to put your Flow on wait, until a response from that card is received.
To try the new feature simply open Power Automate designer and then add new action from Microsoft Teams group:
- Post an Adaptive Card as the Flow bot to a Teams user and wait for a response
- Post an Adaptive Card as the Flow bot to a Teams channel and wait for a response
Note! Today Microsoft Teams still works with version 1.0 of Adaptive Cards. If you don’t want to loose any functionalities of your designed card stick to those from SDK version 1.0 (https://github.com/microsoft/AdaptiveCards/releases/tag/v1.0)
If you’d like to use some of the features from versions 1.1 and 1.2 please turn your Teams (desktop or web) into “Developer Preview”:
GA of Teams with support for latest Adaptive Cards SDK is expected to arrive within the next term, however some features as Media element are not going to be yet supported.
Ok, to design a card you need to use https://adaptivecards.io/designer to do it today:
After you finish designing, you can switch designer into “Preview mode” and then hit the “Submit” button to check what is the data structure that is going to be sent back to Power Automate. It is important to define “Id” of the fields since this are going to be names of the params available for other actions:
Once you’re done with designing, copy the JSON and paste it in your action + configure the action – decide to which Channel it will send the card and set other options:
- Choose Team
- Choose Channel
- Paste JSON code of a valid Adaptive Card
- Confirmation message that will be used to replace the “Body” part of Adaptive Card content once user submits form in a card. This is optional.
- Option used to configure whether confirmation message should be shown or not. By default “No”.
Note! Today there is no way to submit data from a card to a specific target URL. You can only submit it back to the action that sent it. Therefore there is a possibility to record ONLY a SINGLE answer per each card.
In the nearest future however designer is going to be embedded as part of the action’s configuration:
That once clicked will open a blade with Adaptive Card designer (interface is a subject to change):
And now you’re ready to test it. Simply save your Power Automate and trigger it. Note that once the flow is running, after it sends your card it starts to wait for the response. The same as if you would send approval task from the flow.
Important! Power Automate will wait not more than 30 days for the response. After that action will be timed-out and flow will fail.
Now navigate to Microsoft Teams to find your generated card. Then fill it with data and hit submit button. You can notice now, that your Power Automate was resumed and data from card is now available for next actions in your flow. Then depending also on how you configured the action – body of the card will either be replaced with confirmation message or visible for other users.
In the nearest future Microsoft will add the following features to the integration:
- Built-in designer for Adaptive Cards. It is said it will be much simpler than the one available on the official site.
- Ready to use templates of Power Automates dedicated for posting and receiving responses from cards.
- Ready to use templates of Adaptive Cards
- Ready to use parts of block to use in Adaptive Cards bodies, such as repeating table.
If you have any questions simply post a comment or send me a message using contact form.