Power Virtual Agents & Adaptive Cards in Microsoft Teams

Mechanics Team
10 min readFeb 21, 2022

Chatbot Demo & Tutorial

Proactive communication for bots

Extend Microsoft Teams collaboration experiences by embedding intelligent Power Virtual Agents into Teams chat. Build interactive adaptive cards for bots to share information, assign chatbots to specific security groups so only users with the appropriate permissions can access them, and see how you can make your bot communicate proactively. We’ll also show you how Teams can be directly embedded into your Power Apps. Microsoft Corporate Vice President, Lili Cheng, from the Power Platform team, joins Jeremy Chapman to walk through the updates:

  • Extend PVA using the Bot Framework Composer to add adaptive cards
  • Proactive communication built into bots
  • Role-based access controls
  • Embed Teams into your Power Apps

QUICK LINKS:

02:32 — Adaptive card experience

05:11 — Proactive logic in bots

06:15 — Role-based access controls

07:29 — User initiated requests

08:43 — Proactive requests using the Power Automate logic

09:40 — Bring Teams experience into Power Apps

11:08 — Wrap Up

Link References:

Check out our show on building intelligent chatbots in Teams at https://aka.ms/TeamsPVA

Build your first bot and find more advanced capabilities by going to https://aka.ms/tryPVA

Unfamiliar with Microsoft Mechanics?

We are Microsoft’s official video series for IT. You can watch and share valuable content and demos of current and upcoming tech from the people who build it at Microsoft.

Keep getting this insider knowledge, join us on social:

Video Transcript:

- Up next, we look at how you can extend Microsoft Teams collaboration experiences by embedding intelligent Power Virtual Agents into Teams chat. We’ll look at how we’ve made it easier to build interactive adaptive cards for bots to share information and assign chatbots to specific security groups so that only users with the appropriate permissions can access them, and how you can make your bot communicate proactively. And we’ll also show you how Teams can be directly embedded into your Power Apps and to walk us through all of this, I’m joined today by Microsoft Corporate Vice President, Lili Cheng, from the Power Platform team. Welcome.

- Thanks. Thanks for having me.

- So first, just a reminder for everyone, Power Virtual Agents is of course part of Microsoft’s Power Platform of low-code tools and capabilities. So Lili, I know that you’ve personally led a lot of efforts to make AI more accessible with things like Azure Cognitive Services and this has really led to a focus on conversational AI with intelligent bots that really can be fused into everyday app experiences. So what’s behind that?

- Well, fusion is a great way to describe what we’re trying to achieve across a few axes: infusing AI, embedding conversation and collaboration into everything you do, and working with fusion teams. So we can get started now by looking at how we’re using AI to make the experiences more natural. As you interact with an app, bots should be able to bring information to you in an intuitive way. With the infusion of AI, we’ve made it so that bots can make decisions and take actions more naturally, maybe based on sentiment or a specific choice you’ve made. This adds sophistication and intelligence to simple Q&A bots resulting in a more positive perception of your company. Also, bots can be infused as part of your everyday app experiences. For example, in a Microsoft Teams chat, they can become virtual members, proactively contributing to providing faster access to information, and these team chat experiences can also be embedded into your Power Apps. Second, this is all made possible through the fusion of a low-code to pro-code approach, where citizen developers with their business-level expertise, can work hand-in-hand with professional developers to easily design and deliver conversational AI experiences.

- And we’ve been following, you know, the evolution of bots for a while on Mechanics. In fact, on our last show, we demonstrated the instant bot authoring canvas, really to build intelligent and responsive chatbots without leaving Teams and doing that all from scratch. And you can check out our show at aka.ms/TeamsPVA. So how do things change though with the most recent round of updates?

- Why don’t I dive right in and show you the updates? First, let’s take a look at the adaptive card experience for developers, now generally available. You can see a few nice examples here for food orders, a rich and interactive expense report, and an input form, and each of these have the code you need to get started. These are a powerful and visual way to display rich information, and you can interact directly and more efficiently without leaving the context of the chatbot. Let me show you how to build one of these in Teams. I’m in the Power Virtual Agents Studio authoring experience, which we’ve integrated directly inside of Microsoft Teams. You’ll see that I’ve started creating a chatbot. This particular bot is a crew assistant bot designed for an airline to help document and check off the different pre-flight steps prior to departure. For this to work, we’ve had to pull in data from the flight schedule, as well as the crew assigned to the flight. The nice thing about this authoring experience is that all of the visuals are representative to what an end user would see, with all of the logic on the right, and now we can make this experience more engaging and visual using adaptive cards. You can extend PVA using the Bot Framework Composer to add adaptive cards or other pro dev extensions.

- And to get all this working you don’t even need to pay for additional Azure services. They’re just included as part of your Power Virtual Agents license.

- That’s right. We want to make it a seamless experience between the two services. In fact, we link to the Bot Framework Composer directly from the Power Virtual Agents Studio. Here, you’ll use JSON to define the user experience of the card. This is one we’ve built that pulls up the relevant flight information and pre-flight checklist items and if I publish this, it will make it discoverable in my Power Virtual Agent. Now, if I head back into the Power Virtual Agents Studio, my adaptive card will show up as a topic for my bot. To pull up the adaptive card, I’ll choose to redirect to the flight milestones update topic. And once that’s loaded in, I can view the bot and test it out in context. So I’ll say I need to update the flight milestones for my flight on the left here and there’s my adaptive card nicely laid out with the flight and checklist info. And if you follow along on the right, you can see that it’s pulling the adaptive card from the Bot Framework Composer.

- Nice, so now the crew has a very rich and app-like experience or interacting with the bot. And this is going to make it a lot more convenient than for example, typing or even speaking your responses to it. At this point though, the bot can now be published in the context of Teams, but how would the crew know that it’s there and actually know where to find it and how to use it?

- That’s right. That’s always the biggest question. How will your audience find the app, and how can you make sure they can easily use it? We’ve been solving this by building our proactive logic into our bots. So when conditions are met, they can proactively reach out and notify users, in this case our pilot crew, without the need to find the bot and interact with it. Going back to the studio, on the right you can see the logic for our bot is calling a Power Automate flow. Here, we can look at the conditions for the proactive notification. In the first step, I can see that we’re triggering the notification 60 minutes before the flight. Once the conditions are met, the bot is actually going to target this AAD group ID, comprising members who are part of the flight crew and then here we’ll see that it posts the adaptive card directly to the pilot’s personal Teams chat. And this way our bot becomes a virtual member of the team, able to send reminders in a timely way to anyone on the flight.

- So now you can interact with the bots in the context of your normal workflow, but I have to ask in terms of permissions and authorization, how do you manage those things, because the pilots can probably see whether or not the plane’s been refueled, but maybe the flight attendants wouldn’t have access to that information?

- Absolutely, and we’ve solved for that. So now we support role-based access controls. So you can specify specific people using a security group, and only those people will be able to interact with the bot or the adaptive card. From the Power Virtual Agents Studio, I’ll click on share and there, I can specify who the bot is shared with. I can share it either with individuals or an Azure Active Directory security group. In this case, our airline gate managers already have sufficient authorization to make changes so I can reuse and leverage my existing security group for this bot.

- And the really nice thing about using these security groups with Azure AD is you can also set them up to be dynamic, by for example, just keying off of an AD attribute, like the title of an individual, so that as somebody enters the organization or their titles change, maybe they’ve got gate manager in their title, the permissions will just get automatically assigned. So now we’ve walked through the build out of the app and also the sharing of permissions in this case. So what would the crew experience then look like using the Power Virtual Agent?

- Sure. I can show you how easy it is to @mention the bot right here from Teams. So the same way I would @mention a peer, I can just @mention the bot at any time to immediately bring information to me. I just type @flight and pull up our crew assistant. Now I ask a question like, I need to update the milestones for the same flight as before. I’ll choose this button for update flight milestones and there’s our card from before with our milestone status. And I can efficiently complete the action right here. So I’ll choose catering unloaded, loading, and cleaning, and then update, and I see a confirmation. And I’m showing you this in Teams, but this same adaptive card can also be embedded in email, search, your custom app, your webpage, wherever it makes sense.

- And really, another bonus here is that, because this is a channel conversation, it’s a persistent message, so not just an individual bot chat experience like we’ve had in the past. That means that the next person who’s going to be in the channel, they don’t have to ask the same questions over and over again. They’re just going to see the recent update in this case. So how else then can you interact with the bot?

- So I just showed you a user-initiated request. Now I’ll show you a proactive request using the Power Automate logic that we saw before. So it’s 60 minutes prior to my flight, and my phone is signed into the Teams mobile app. You’ll see the crew assistant bot has proactively notified me as the crew manager to review the status of the flight departure. I’ll open it, and you can see there are only two milestones remaining. In our case, we have a passenger who will need help deboarding, so I’ll request that the mobility crew is available at our destination, and I’m just using the touch keyboard to type this out in this case. You’ll see the bot confirms the request and will dispatch the mobility team.

- And it’s a much more human-like experience, I gotta say, in terms of having that bot proactively notify you. So now we’ve seen things like Power Platform components being able to come into Microsoft Teams, but conversely, I know we’re working on ways to bring the Microsoft Teams experiences into our Power Apps.

- Exactly. People are spending so much time communicating and collaborating, we want to make sure that everyone can bring conversational AI experiences into their own experiences. So let’s take a look. So I’m in our airport operations app here, and this page is pulling in a dashboard from Power BI. This is a view you might have from the airline’s headquarters and we can see the average takeoff delay time here for each recurring flight. This flight, 574 to Dublin, happens to be the most on-time flight and we want to to reach out to its crew to see what they’re doing to have these amazing results and thank them. So I’ll go into our active flight list. I can search for our flight and select it. That pulls up a flight summary with the assigned crew and now if I hit this conversations icon, I can start to engage directly with the crew members. Teams is actually embedded here within my Power App. I can see Adele is the senior pilot from the flight and ground crew, so I’ll reach out to her and start the conversation to learn more.

- So many amazing updates to Power Virtual Agents and what’s the team working on next?

- Well, really just making conversational AI more accessible to more people. So whether that’s infusing bots into your everyday Power App or app experiences or supporting more fusion development scenarios between citizen and pro developers.

- So for anyone who’s watching right now and wants to learn more, what do you recommend they do?

- So, you can get started and build your first bot and find more advanced capabilities by going to aka.ms/tryPVA. Proactive messaging for bots is in preview, and in-channel conversations are coming soon. Additionally, you’ll be able to embed Teams conversations into Power Apps, so keep watching the space for when it’s ready. And if you have Dynamics 365 Sales, you can actually try it there now.

- Thanks so much Lili for joining us today and sharing all the updates to Power Virtual Agents. And of course, keep watching Microsoft Mechanics for all the latest tech updates. Subscribe to our channel if you haven’t already and thank you for watching.

--

--