Featured image of post Post Adaptive Card from Power Automate

Post Adaptive Card from Power Automate

Laura GB

Introduction

I am doing a session on the best ways to transform data from Power Automate. The session message will be to not use Power Automate for complex data transformations but call something else. Rather than just show look it transformed data each demo is going to end with sending an adaptive card to Teams.

This will all be done from a child flow. Rather than explaining how I built the child flow before I do the demos this post is the explanation. I also need some public images to use in the card and so they will be at the end of this post.

For those who are curious the session is Friends Don’t Let Friends Manipulate Data in Power Automate

Requirements

The flow must send to the selected teams channel a card that contains the following

  • title including the start of week date
  • image url based on the image name, eg fabric or powerautomate
  • Total sales formatted as money £#,##0
  • Number of orders
  • Name of the top sales person
💡 Tip

The image url must point to a publicly available image.
This is the other reason for this post!

Trigger

In Power Automate we create an instant cloud flow. This adds a “manually trigger a flow” trigger. We then add to that trigger 5 parameters

TypeParameterDescription
TextImagePlease enter picture name
NumberTotal SalesPlease enter a number
NumberTotal OrdersPlease enter a number
TextTop SalesPlease enter the name of the top sales person
DateWeek DatePlease enter or select a date (YYYY-MM-DD)

Screenshot of the above parameters in the trigger settings

Format the data

One of the requirements is the sales is formatted as money and in the card all of the data is annotated with pre or post fixes, for example 171 becomes “Total Orders : 171”.

For this I’m going to use a trick using Parse JSON rather than 5 variables. I add a Parse Json action to the flow. Into the content I build a json statement using dynamic content.

For the formatting of the sales to money I use the formatNumber function.

1
formatNumber(triggerBody()?['number'],'#,##0')

Once the JSON statement looks correct I copy it. Then I click Use sample payload to generate schema and paste in the JSON. The click done for the schema to appear.

Screenshot of the parse json action with content matching the code below and a generated schema

The code I used for the content is this:

1
2
3
4
5
6
7
{
  "weekdate": "Week @{triggerBody()?['date']}",
  "imageurl": "https://hatfullofdata.blog/theme/@{triggerBody()?['text']}.png",
  "totalsales": "Total Sales : £@{formatNumber(triggerBody()?['number'],'#,##0')}",
  "totalorders": "Total Orders : @{triggerBody()?['number_1']}",
  "topsales": "Top Sales : @{triggerBody()?['text_1']}"
}

I test my flow and make sure that the output looks correct. The most important part is that there are values listed in OUTPUTS such as Body weekdate with a value Week 2026-11-08.

Screenshot of the output from a flow test showing the values from the json

Design Adaptive Card

The next part is to design the adaptive card. For this I head to https://adaptivecards.microsoft.com/designer. I build the adaptive card to look as I want it to look. Then I copy the Card payload.

Screen shot of Adaptive card designer website with the card designed

Compose the card with values

Back in the Power Automate flow I add a compose step. And I paste in the Card payload. I then find each value that I want to come from the parse JSON step and add in the dynamic content rather than the hardcoded values.

In my example there were 5 text values and an image url to swap. Be careful to keep the "..." around values and the commas to keep it valid JSON.

Screenshot of the compose step

Post card to Teams

The next step is to post the card to the teams channel. For this we add a Post card in chat or channel action and fill in the details. The adaptive card comes from the compose step.

Screenshot of the Parameters and the final card

Then we run the flow to test it and make sure it works.

Make it a child flow

Back in 2022 I wrote a blog post Power Automate Child Flows. It states we need a last action of a Respond to a Power App or Flow and update the connection to be used.

It appears it no longer needs to be a flow in a solution.

Respond to a Power App or flow activity in the flow, plus updating the connections used in the flow

Images

The real reason for this blog post is to publicly publish the images I’m going to use in the demos.

Power Automate Office Script Power BI Fabric SQL Data Pipeline

2026 Laura Graham-Brown
Built with Hugo
Theme Stack designed by Jimmy