How to build your own Chatbots in Microsoft Teams with Power Virtual Agents

Mechanics Team
11 min readJan 20, 2021

Create intelligent chatbots directly in Microsoft Teams using Power Virtual Agents (PVA). We’ll also show how the integration with the Bot Framework Composer lights up new capabilities for building even richer custom experiences. Jeremy Chapman is joined by Emma Archer, Principal Group Program Manager for Power Virtual Agents, who shows you how easy it is to create a new PVA bot in Teams and how to extend it with custom capabilities, leveraging the Bot Framework Composer.

Create intelligent chatbots using PVA

With so many of us working remotely, it can be harder to get your questions answered. We’ve integrated PVA to give you an instant bot authoring canvas to build intelligent and responsive chatbots without even leaving Teams. You can build custom virtual chat experiences to engage with your team, address frequently asked questions, and save time by triaging common IT questions. And the good news is that Power Virtual Agents is included in your Teams license.

Just released to public preview is our deep integration of PVA with the Azure Bot Framework Composer. This offers richer experiences, such as adaptive dialogues that give you a way to code complex event-driven dialogues. Bots can easily switch contexts mid-conversation and then switch back, so they appear less robotic. Or use adaptive cards that give you a rich, interactive display and enable you to incorporate images and videos.

QUICK LINKS:

02:03 — See an example of a chatbot

02:55 — How to build your own chatbot

04:54 — How to create a complex interaction

07:21 — Azure Bot Framework Composer

08:39 — See Bot Framework Composer in action

10:39 — How to make chatbots available within Teams

12:33 — Closing notes

Link References:

Watch an introduction to Power Virtual Agents at https://aka.ms/PVAMechanics

To learn more go to www.powervirtualagents.microsoft.com

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.

Video Transcript:

- Coming up, I’m joined by Product Lead Emma Archer, to take a look at how you can now use Power Virtual Agents to create intelligent chatbots directly in Microsoft Teams. We’ll also show how the integration with the bot framework composer lights up new capabilities for building even richer custom experiences. So Emma, welcome back to the show.

- Thanks Jeremy. It’s great to be back. And thanks for joining us from home today. So, before we get into this, if you’re new to Power Virtual Agents the service, or PVA as it’s called, it’s part of Microsoft’s Power Platform, and it really gives you a zero-to-low-code, AI-rich way to build intelligent chatbots. In fact, we did an introduction to Power Virtual Agents just a few months back that you can watch at aka.ms/PVAMechanics. So Emma, what have you and the team been focused on for the latest round of updates?

- Well, with so many of us working remotely today, it can be harder to get your questions answered. So we’ve been focused on how we can expand the use of Virtual Agents to help. Many of us are using Teams as our collaboration platform. So one of the major updates is the integration of Power Virtual Agents. This gives you an instant bot authoring canvas to build intelligent and responsive chatbots without even leaving Teams. And the good news is, that Power Virtual Agents is included in your Teams license.

- And just to put this into context, we’ve had the ability to create simple bots in Teams for a while now, but this takes things to another level, right?

- It does. If you’re one of the millions of Teams users today, you’re probably predominantly using it for chat or online meetings. With Power Virtual Agents, you can build custom virtual chat experiences to engage with your team. For example, as a manager or an HR professional, you can quickly build an FAQ chatbot for Teams, or maybe you want to address frequently asked questions about returning to work during this time of COVID-19. Or if you’re in IT, you can save time by creating intelligent service desk chatbots that triage common IT questions.

- Great, so can you show us an example?

- Absolutely. So I’ll start by showing you an example of the chatbot that I’ve already built, and then I’ll show you how easy it was to create it within Teams. I have here, a HR assist chatbot that enables employees to ask questions about time off, public holidays, how many days do they have left, etc. So I’ll type ‘want info on national holidays.’ And you see it shares that information. Let’s try something harder. I’ll type ‘how many vacation days do I have?’ And it asks me to choose between national holidays or paid time off. I’m going to choose paid time off. And it looks like I’ve got zero days left.

- Yeah. And that was totally natural interaction there. And there’s obviously though a lot happening behind the scenes, including some integration then with your user profile, maybe the backend HR system that can track your vacation days that you have left. Unfortunately, zero at the moment. But, how did you build all this out?

- It’s pretty simple. Really, anyone can author chatbots like this. First, let me tell you how to get Power Virtual Agents for Microsoft Teams. You go to the app store, or you can click on the ellipse and search for Power Virtual Agents, click on add for me. And here’s the app in the nav bar. Let’s pin it so it’s always present for quick access. From here, I can go ahead and create my first bot. So we’ll click start now. I select my team that I want it associated with. I want this one and we’ll click continue. And now I can give my chatbot a name. Let’s call it HRassist, select a language, and that’s it. I have my chatbot and I’m ready to start adding content.

- Okay. So that looked pretty simple, but how easy is it to build then that interaction that we saw earlier?

- It’s super simple. Here’s the Power Virtual Agents left-hand nav. Let’s expand that out this first time through so you can see. We’re going to the topics list page, and you can see that the chatbot comes with some out-of-box content, a few sample topics and some system topics, which are pre-built responses like a standard welcome or goodbye message. And I’m going to create a new topic that focuses on time off. I’ll click on the plus, the new, give my topic a title, ‘Employee time off,’ and add a few trigger phrases. What are the national holidays, need info on time off, how many vacation days do I have, I need help with time off. Now, I’ll go to the authoring canvas and we can see trigger phrases here at the top. And I can populate this message node with info pointing the user to an internet site that’s got info on paid time off. Keeping it very simple to start with. So I’ll paste in the message with the links for further information, I’ll save it and we’ll test it. Let’s type, where do I go to get info about time off? And here you see the bot is providing a response.

- And that’s really a great option to just get users the information that they need as fast as possible. But how did you create that more complex interaction that we saw earlier?

- Yeah, so that’s the beauty of PVA. Your chatbot uses AI to make decisions and take actions. I’m going to delete that message node that we had there. And instead, I’m going to ask a question. We’re going to ask, what info are you looking for? And that’s going to present two options. I’m going to present national holidays and paid time off. Notice that the dialogue has automatically branched creating two conditional nodes for us. And now I’m going to go ahead and store the user selection as a variable. And I’m going to call that leave type, so we can more easily track it in the topic. For national holidays, I’m going to go ahead and add the content here directly. Now for paid time off I want to do a look up in our HR app and see how many vacation days I have remaining. And for this, I’m going to add an action, that calls a Power Automate flow called get vacation balance to do that look up, which I pre-created here in the interest of time. And if you’ve not used Power Automate before, it gives you access to hundreds of pre-built connectors to connect to existing apps and services.

- So, do you need to do anything then to specialize or personalize the response to the user? How does it know for example, who was making the request?

- Well, because the user’s already signed into Teams, we know who they are, we know their alias, etc. So we can use that information as an input. You can see, it takes the user’s display name as an input here, and it returns the variable balance as an output. Let’s add a message node to output that info to our user. ‘You have X days remaining.’ Okay, we’re ready to save and test it. And we’ll enter, ‘we want info on national holidays,’ and you can see that the bot is smart enough to skip over that question and instead directly display the national holidays.

- Wow, that is smart. So, as I recall though, it’s using a capability that’s called Entity Slot Filling, really to skip over the questions that it already has answers for.

- That makes the conversation more streamlined and efficient. Now, let’s also test the vacation days portion of the dialogue. I’ll reset and I’ll type ‘need info on time off.’ And you can see it’s calling a flow, doing the lookup based on my user details. I’m going to choose paid time off and you can see, ah, I’ve got eight days remaining.

- Nice. And that’s so much better than having zero days left. So what else can you do then to customize the chatbot?

- This is where Power Virtual Agents becomes a bridge between your business users and professional developers who can build out even richer experiences for you.

- Okay. But we’ve had the ability for a while though, to call a bot that we created using the Azure Bot Framework as a skill from within PVA before, right?

- Yeah we have, but this is different. We’ve just released to public preview our deep integration of Power Virtual Agents with the Azure Bot Framework Composer.

- Okay. So what are some of the things I can do there?

- You can author much richer experiences, such as adaptive dialogues that give you a way to code complex event-driven dialogues. For example, you want to look up a flight and you want to see what the weather is like in that location at the same time. And the bot can easily switch contexts mid-conversation and then switch back. Or language generation that dynamically varies the chat responses, so they appear less robotic. Or adaptive cards that give you a rich, interactive display and enable you to incorporate images and videos.

- That sounds pretty amazing. Can we see a few of these in action?

- Sure. So I asked Salem, a ProDev colleague, to build out a Bot Framework Composer dialogue to collect pertinent information about extended leave requests. So let’s walk through what he did. On the topics list page you can click, open Bot Framework Composer to launch it. Now, if you haven’t already installed it, it will install it for you from GitHub. Here it’s pre-installed. So now it’s starting to import the bot content from PVA over into Composer, and it will prompt you to sign in the first time you do this. Here he’s going to add a request leave dialogue, specifically for folks needing to take a longer leave, say for medical purposes. You can see here that he’s already prebuilt an intent trigger, which fires upon detection of one of the trigger phrases: request leave, extended leave, maternity and paternity leave. Now Power Virtual Agents natural language understanding is being used for the intent recognition behind the scenes here. This is going to call a new dialogue that will present an adaptive card to the user asking them to provide the from and to dates and the reason, and then to click on submit when they’re done. And that will call a Power Automate flow to notify the HR specialist that there’s a new request to approve. And here, you can see he’s adding a response that goes back to the employee to let them know that the request has been sent to the HR specialist for consideration. You can see here, these are the bot responses he’s created. This is where he’s sending the adaptive card and this is the adaptive card he created to send back to the user. So now, he’s going to publish those changes back into PVA. And once that’s completed, you can see here the request leave trigger and the request leave dialogue imported into PVA, and now it’s integrated and ready to use.

- Okay, great. So how then do you make the chatbot available within Microsoft Teams for other people to discover and use it?

- So that’s our final step. Let’s navigate over to publish, click on the publish button and confirm, and that’s going to propagate out our content that we’ve just added and make it available. We’re also going to click on share the bot, and this is how we make it visible to other folks within the app store. We have a couple of options here. You can see submit for admin approval. If that’s approved, your bot will be made available across an entire tenant, so that everyone in your organization can use it. Or more commonly you’ll want to do add to Teams. And this makes the bot visible in the share with colleagues section within the app store. We’re going to share with our team for demo purposes. So let’s close that and navigate out to the app store to show you where to find it. We click on the ellipse and more apps. Then under Built for Contoso, you’ll probably see your own company name here, and we’ll scroll down to the bottom. And there’s a section here you can see called built by your colleagues, and you’ll find it here. You want to install it and pin it to the left-hand nav.

- So I’m going to actually try this out. First I’m going to make a request, and it looks like I’m out of vacation days like you were earlier. And I need info then on extended leave, so I’ll ask that. Now the bots can actually prompt me for a form to complete. And you can see it’s asking me to provide things like the from and the to date range, and a reason. So I’ll say medical procedure, need time off to recover, and then I’ll hit submit, and that’s going to go to an HR specialist for review.

- So now I’m logged in as the HR specialist, and in the HR specialist channel I can see your request has come in and I can review it. Everything looks good. So I’ll hit approve. So you’ve seen how easy it is to create a new Power Virtual Agents bot in Microsoft Teams. You can start simple and add intelligence as you need to. And you could even extend it with custom capabilities, leveraging the Bot Framework Composer.

- It’s awesome to see both the integration of Power Virtual Agents with Microsoft Teams and also the new integration with Bot Framework Composer, but for the folks who are watching from home, where should they go to learn more?

- Yeah. So you can either go directly to powervirtualagents.microsoft.com or you can install it from Teams as we showed you by searching for it in the app store.

- And for those of you joining us online, thanks so much for watching, that’s all the time we have for today’s show. Subscribe to Microsoft Mechanics if you haven’t already and goodbye for now.

--

--