Top
Power Automate + Adaptive Cards + Microsoft Teams

Register response from custom Adaptive Cards sent from Power Automate to Teams


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
New actions in Power Automate to post Adaptive Card to Teams and wait for 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”:
https://docs.microsoft.com/en-us/microsoftteams/platform/resources/dev-preview/developer-preview-intro

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:

New action in Power Automate to post Adaptive Card to Microsoft Teams and wait for response
  1. Choose Team
  2. Choose Channel
  3. Paste JSON code of a valid Adaptive Card
  4. 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.
  5. 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:

Adaptive Cards designer inside Power Automate action's configuration
T

That once clicked will open a blade with Adaptive Card designer (interface is a subject to change):

Adaptive Cards designer displayed as a blade inside Power Automate

That’s it!

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.

Roadmap

In the nearest future Microsoft will add the following features to the integration:

  1. Built-in designer for Adaptive Cards. It is said it will be much simpler than the one available on the official site.
  2. Ready to use templates of Power Automates dedicated for posting and receiving responses from cards.
  3. Ready to use templates of Adaptive Cards
  4. 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.


Tomasz Poszytek

Hi, I am Tomasz. I am expert in the field of process automation and business solutions' building using Power Platform. I am Microsoft MVP and Nintex vTE.

35 Comments
  • Efialtes

    Tomasz
    Thanx for your detailed explanation! This feature sounds great!
    However, I tried today to play a while with the new action blocks, unfortunatelly, and they are not shown in my editor.
    Then I checked Teams connector documentation, and both of then are displayed as deprecated.
    Are you experiencing the same or am I missing something?

    https://docs.microsoft.com/en-us/connectors/teams/#post-an-adaptive-card-as-the-flow-bot-to-a-teams-channel-and-wait-for-a-response-%5Bdeprecated%5D
    https://docs.microsoft.com/en-us/connectors/teams/#post-an-adaptive-card-as-the-flow-bot-to-a-teams-user-and-wait-for-a-response-%5Bdeprecated%5D

    January 22, 2020 at 7:24 pm Reply
    • Tomasz Poszytek

      Yes, these actions will just arrive this quarter. And that documentation is strange. Maybe author meant that they are in [Preview]? Don’t worry. They are not deprecated before they are available 😛

      January 23, 2020 at 11:01 am Reply
    • Tomasz Poszytek

      That’s valid for the old, early preview versions. Documentation will be updated.

      January 24, 2020 at 12:30 am Reply
  • Viji Swami

    Hey Tomasz, I tried it but it still shows the same error.

    February 7, 2020 at 8:50 am Reply
    • Tomasz Poszytek

      Please share more details.

      February 7, 2020 at 9:09 am Reply
      • Viji Swami

        I have an adaptive card for approval to post in MS teams. I choose the option of post card in Teams and wait for response. However, when I click any button on the card, it says, cannot reach app, try again.

        February 7, 2020 at 9:52 am Reply
        • Tomasz Poszytek

          Are you posting it to a Channel or to a User? If to a Channel, then this shouldn’t work – this AC should be sent to the assignee.

          February 7, 2020 at 9:56 am Reply
          • Viji Swami

            I am posting it to a channel as of now. So they have not fixed the error for posting it to a channel is it?

            February 7, 2020 at 10:08 am
          • Tomasz Poszytek

            Is it your custom card? Or the one that “Approval” is generating? If the one from Approvals action, then no – posting to channel shouldn’t work. If your custom card then remember – action “Post card and wait for the response” is still in preview and due to changes and issues.

            February 7, 2020 at 10:26 am
  • Viji Swami

    It is a custom card yes, I made it from adaptivecards.io. Ok thanks a lot…

    February 7, 2020 at 10:37 am Reply
  • Adrian

    I have the same problem with the action “Publish an adaptive card for a Teams user and wait for a response (Preview)”: I configure it with a card generated from adaptivecards.io but I get the “Unable to reach ” error when clicking the adaptive card’s button from Teams.
    Been going at it for several days now, it’s rather frustrating…

    Under what circumstances is the preview supposed to work?

    February 12, 2020 at 7:14 pm Reply
    • Tomasz Poszytek

      Do you have an issue with the second action, that sends adaptive card to a channel? Do you have experimental features in Power Automate turned on?

      February 12, 2020 at 9:50 pm Reply
  • Noel Mayr

    Hello,
    the card worked well but i cant get the output.

    outputs(‘Post_an_Adaptive_Card_to_a_Teams_channel_and_wait_for_a_response’)?[‘body/data/ac_mail’]

    {
    “type”: “Input.Text”,
    “placeholder”: “Mail”,
    “id”: “ac_mail”,
    “separator”: true,
    “style”: “Email”
    },

    doesnt work.

    Error:
    Make a correction to include a valid reference to “Post_an_Adaptive_Card_to_a_Teams_channel_and_wait_for_a_response” for the input parameters of the action “E-Mail-Notification_senden_ (V3)”.

    March 12, 2020 at 2:51 pm Reply
    • Tomasz Poszytek

      Try to put that output into a compose action and check if you are getting the value. Optionally try to build the reference this way: outputs(‘Post_an_Adaptive_Card_to_a_Teams_channel_and_wait_for_a_response’)?[‘body’][‘data’][‘ac_mail’].

      March 12, 2020 at 2:54 pm Reply
  • Davide Mercadante

    Hi Thomas,

    Your blog posts and I here to ask a bit of help. I have an adaptive card created when a new project intake is created in a Sharepoint List. The outputs of the card will update the status of column in Sharepoint list. The work works fine, but I have an issue. The card is posted to a private channel in Teams and it might happen that one of the approved could change manually the column in Sharepoint. Is there a way to change/update the adaptive card if the originating list is changed? Thanks in advance, Davide

    May 6, 2020 at 6:33 pm Reply
    • Tomasz Poszytek

      Hi, unfortunately this is a weakness of this technology. Using Power Automate you can only update that card once it is submitted back to flow. No other way. You would need to implement your own bot that posts cards and handles that scenario. If I could advise anything, that would be to block changes directly on the SharePoint list.

      May 7, 2020 at 11:26 pm Reply
  • Varun Bhatia

    Hi. I was looking for a way to use the same flow of sending the Adaptive card to multiple users (not a channel). But it takes a single user (in the send Adaptive card and wait for response step), and if I just send an adaptive card with Action.Submit, it says “Unable to reach app. Please try again.” in teams when I press submit. I have configured a REST URL to accept HTTP requests. But this solution is not working on teams, works on Outlook though.

    July 1, 2020 at 8:33 pm Reply
    • Tomasz Poszytek

      For Teams Adaptive Cards JSON schema doesn’t allow “URL” for Action.Submit. You should use action “Send Adaptive Card to Teams User (or Channel) and wait for response” – nevertheless it will wait only for first response. No way to use the same AC for multiple responses yet. You can do that in a loop, so to send multiple Adaptive Cards to multiple users, via a Child Flow. Or… build your own custom solution that uses Adaptive Cards SDK. No other option i’m afraid.

      July 7, 2020 at 2:03 pm Reply
  • rf

    “Post an Adaptive Card to a Teams channel and wait ” sends the adapative card as the Flow bot atm. Is there a way you can post it as a different user?

    July 9, 2020 at 4:07 am Reply
    • Tomasz Poszytek

      Unfortunately not. Using this action cards will always be sent by the “Flow Bot” – this is the bot that takes the contents, parse it and then sends to Teams for display. You can write your own bot, that will display cards, nevertheless it is not happening in a context of a specific user.

      July 9, 2020 at 11:54 am Reply
  • Prashant

    Thanks Tomasz for the detailed post.
    I am a flow to send adaptive cards to multiple user and wait for the response and the flow is sending cards but problem is all users wont receive cards at a time this is because the flow is waits for the response from the first user and only when it receives the response from the first users the flow sends second card to second user.
    How can I send cards to all users at the same time and wait for the response and also can we keep this response optional since not all users will respond to it( considering some of them are on leave or busy with meetings).

    Any thoughts?

    Regards,
    Prashant

    August 1, 2020 at 10:23 am Reply
    • Tomasz Poszytek

      Hi, you can try to invoke a child flow that will send a card to a user, and make that in a loop per each user. So that your parent flow will not get stuck waiting, but it will delegate it to child flows.

      August 7, 2020 at 8:16 am Reply
  • AN

    “Post an Adaptive Card to a Teams user and wait” sends adaptive card to one user . How can i send to multiple users at the same time using loop ? As we cant iterate loop untill the response from first user is obtained . How can we overcome or address this ?

    August 5, 2020 at 10:50 am Reply
    • Tomasz Poszytek

      Hi, you can try to invoke a child flow that will send a card to a user, and make that in a loop per each user. So that your parent flow will not get stuck waiting, but it will delegate it to child flows.

      August 7, 2020 at 8:20 am Reply
  • Anthony Anyoti

    Hi Tomasz,

    I need your urgent help, I am facing an error with Post an Adaptive Card to a Teams channel and wait for a response but cant figure out where the error is coming from. Error details are below and its bit vague, not sure where to start troubleshooting from. Note the flow has been working flawlessly for weeks until 24hrs ago when am consistently getting this, so am baffled how suddenly the JSON content has all of a sudden become invalid.

    Error
    Action ‘Post_an_Adaptive_Card_to_a_Teams_channel_and_wait_for_a_response’ failed
    Error Details:
    Http request failed: the content was not a valid JSON.

    Any help and insight into this issue will be so much appreciated.

    Anthony

    I have been using schema 1.2 without any issue until 24 hours ago, this is the first time the flow has failed. The J SON renders in the Adaptive Card designer using Microsoft Teams host app.

    August 11, 2020 at 9:49 am Reply
    • Tomasz Poszytek

      Hi, are you using templating? Anyway, the best approach is to first use one of the “online json validators” to check if yours adaptive card JSON is valid. Then go to https://adaptivecards.io/designer/, paste your code and check if it renders. If not, then obviously something is invalid in the code, try then to debug it by removing piece by piece until it works to determine which block might be causing issues.

      August 11, 2020 at 9:53 am Reply
  • Anthony Anyoti

    Thanks for the response Tomasz, the code renders in https://adaptivecards.io/designer/ without an issue, and until yesterday was working very well. I suspect something has changed with the Post to Teams channel and wait for a Response connector, but I have no logs other than the one i sent to troubleshoot why.

    I just tested the code with an online json validator and its valid.

    I find it a bit strange for the code to work for over a month and then just suddenly stop, and thats why I suspect its an issue with the Teams action in power automate.

    August 11, 2020 at 12:46 pm Reply
    • Tomasz Poszytek

      Do you have a custom data put inside that card? Like outcomes from other actions prior to posting Adaptive Card? Maybe data they return is invalid. Look at the run that failed. Expand the action. Copy the generated JSON that you can find in action’s execution details and check that one. Maybe in your data (if you pass any) you have quotes, or ampersands, that breaks the validity of schema?

      August 11, 2020 at 3:12 pm Reply
  • Anthony Anyoti

    Thanks again Tomasz, I appreciate the assistance. Unfortunately expanding the action only reveals the below and nothing else, which is puzzling as it doesnt give any detailed output like other entries. I had some data from other action outcomes, and to test I did remove them completely, leaving the raw JSON code only, still the error persists. Will continue troubleshooting and let you know what I find.

    BadRequest. Http request failed: the content was not a valid JSON

    August 11, 2020 at 6:24 pm Reply
    • Tomasz Poszytek

      What you can try is to first author the JSON inside a “Compose” action and then use its outputs in the “Post Adaptive Card and wait” action. Then once flow fails you will be able to see what the actual outcomes of the generated AC JSON are 🙂

      August 11, 2020 at 11:27 pm Reply
    • Anthony Anyoti

      Hi Tomasz, just to let you know that this is now resolved. All I did is use the output validated code from the online json validator and its working!! :)) Thanks so much for all your help.

      August 12, 2020 at 6:21 am Reply
  • Maithili Kotla

    Hi Tomasz, thanks for this wonderful article. Is it possible to update the format of the “Update Message” to same as the original format of the card. Looks like the Update Message does not take JSON. Can you confirm please?

    September 2, 2020 at 4:48 am Reply
    • Tomasz Poszytek

      Unfortunately this is not yet supported when talking about sending Cards using Power Automate. It will always be replaced by a pre-defined Card stored in FlowBot 🙂

      September 3, 2020 at 8:15 pm Reply

Post a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.