Collaborate on Microsoft Teams using Flow and Adaptive Cards

You are currently viewing Collaborate on Microsoft Teams using Flow and Adaptive Cards

Microsoft Teams is your hub for teamwork in Office 365. All your team conversations, files, meetings, and apps live together in a single shared workspace, and you can take it with you on your favorite mobile device.

With the growing popularity of Teams, it’s essential that we must design our system to collaborate and share as much information as possible using Teams.
With this thought in mind, I remember seeing a post and a video on posting messages on Teams using MS Flow. Sometime back Flow has introduced new actions to post information on Teams using Adaptive Cards, and believe me, this is really a game-changer.

What are Adaptive Cards? 🤔

Adaptive Cards are an open card exchange format enabling developers to exchange UI content in a common and consistent way.
Card Authors describe their content as a simple JSON object. That content can then be rendered natively inside a Host Application, automatically adapting to the look and feel of the Host.

How to send information to Teams using Flow?

We can post information in Teams using multiple options provided by the Flow actions, such as Post a Message, Post a message as the Flow bot to a channel or a user and of course, Post your own adaptive cards as the Flow bot to a channel or to a user.

To make this feature work, we need to add MS Flow as an App to our MS Teams as it relies on Flow Bot to post the information using adaptive cards.

An Example: Send an alert to a Teams Channel on Case Creation

To illustrate a very simple use case, when a new case is created in Dynamics 365, I am going to post a message using an adaptive card. Now to so do we need to perform a few simple steps. So let’s get started.

  1. Firstly, we are going to create an adaptive card using Adaptive Cards designer. It’s a very simple UI designer, and there are plenty of sample cards available to start with.
    After designing the adaptive card, we need to copy the JSON from the Card Payload Editor.

2. Once our adaptive card is ready, we can jump directly into the MS Flow and design a simple flow based on our requirements.
Here, I have used a CDS trigger, ‘when a record is created’, then I am resolving Customer Name based on Customer Type as Account or Contact, and finally, I am posting information to Teams.

As Customer a special lookup field, I need to fetch the Customer Name from Dynamics 365 based on Customer Type and then store that value in a variable.

3. In the final action to Post your own adaptive card as the Flow bot to a channel, copy the JSON of your card from earlier step into the message.
Then, add the dynamic values in the message using the Add Dynamic Content pop-up window. So I have added some values required for my adaptive card and that’s all.

Right now, it’s little bit difficult to use the Add Dynamic Content pop-up window as you have to scroll all the way down to find the action control to use it.

May be before these action comes out of preview mode, Microsoft will solve this problem.

Now we are ready to test.
So, I created a new Case in Dynamics 365 with basic information as below.

This is the outcome of my Flow in Teams. Now, members of this team can click on View Case button to open the case.

Adaptive Cards in Teams

Use case scenarios

As we just saw, it’s very easy to design the adaptive cards and it can be used on various applications seamlessly.
As Microsoft itself is focusing so much to provide Microsft Teams as a single platform where customers can work and collaborate easily instead of navigating to multiple applications, I think as a solution provider, we need to contribute by utilizing the power of Flow to ensure this vision.
Some of the use cases I can think of are:

  • We can use the cards to replace email notifications with fancy and intuitive cards.
  • For simple scenarios, such as getting approval, sending reminders or agenda or getting quick inputs instead of logging into an application, these adaptive cards are perfect replacements.

I hope I was able to spark the interest to look into this feature and I hope it helps your client. I am sure we all can find out lots of use cases for this feature.
Till next time, Cheers 😉

References:

Manish Rawat

Microsoft Certified: Dynamics 365 + Power Platform Solution Architect Expert, with little Knowledge of Scrum (PSM-I) & keen to learn about Power Platform 😎