Integrate your No-Code Power Virtual Agents with Low-Code Bot Framework Composer
Tags: powerfuldevs, botframework, azure, beginners
Published: 2020-11-23 22:40:33

<a href="https://mybuild.microsoft.com/">Microsoft Build 2020</a> has been quite interesting; not because it was virtual but because I got a chance to represent the <a href="https://www.youtube.com/watch?v=m6ekrMCFCr8">Australian Developer Community for Azure</a> &amp; we witnessed a new way of integration between Bot Framework Composer and Power Virtual Agents using <strong><a href="https://youtu.be/Vch_HNHNBEc?t=146">Composer Topics</a>.</strong>

<!--more-->
<blockquote>If you know me or you've been a frequent reader of my blog then you will know what Conversational AI mean to me. I've covered several topics on <a href="https://www.arafattehsin.com/integrate-luis-qnamaker-dispatch-part-1/">Bot Framework SDK</a>, <a href="https://www.arafattehsin.com/build-a-flight-tracker-using-bot-framework-composer-part-1/">Bot Framework Composer</a>, <a href="https://www.arafattehsin.com/category/power-platform/">Power Virtual Agents</a> and <a href="https://www.arafattehsin.com/empower-your-existing-power-virtual-agents-with-bot-framework-skills-%f0%9f%a4%96/">their integration</a> with each other.</blockquote>
As a Conversational AI enthusiast, I was following that new integration very closely. Later during Ignite 2020, this was changed to have even <a href="https://youtu.be/I04xGaGBct4?t=900">deeper integration</a> with Bot Framework Composer rather than just getting exposed as a Skill (<em>I'll discuss why it's better in a bit</em>). More exciting!

Finally, the day has arrived when Microsoft Power Virtual Agents can be <a href="https://powervirtualagents.microsoft.com/en-us/blog/power-virtual-agents-integration-with-bot-framework-composer-is-available-in-public-preview/">integrated seamlessly</a> with the powerful Bot Framework Composer. You can simply download the latest Bot Framework Composer from <a href="https://docs.microsoft.com/en-us/composer/install-composer">here</a>.

I will not go in to the basics as this post is mainly targeted for the integration. Therefore, if you're looking for some basic tutorials on getting started with either Power Virtual Agents or Bot Framework Composer, you can always check out <a href="https://www.youtube.com/channel/UCn8PsBlVsGUt8J3tZCKsMPA">this</a> and <a href="https://www.arafattehsin.com/build-a-flight-tracker-using-bot-framework-composer-part-1/">this</a>!
<h3>Where should we begin?</h3>
As I knew (from Ignite 2020), this was coming so I started <a href="https://github.com/microsoft/BotFramework-Composer/issues/4785">playing with stuff</a> when it was in a Preview. The fantastic Bot Framework Composer team has always been responsive, super supportive and patient with me. Eventually, when I got <a href="https://github.com/microsoft/BotFramework-Composer/issues/4813">this working</a>, I thought to write a step by step guide for you to get yourself started!

First of all, for some clarity, I'd like to tell you that this capability of integration works both ways (i.e. <strong>Power Virtual Agents ↔ Bot Framework Composer</strong>). However, as Bot Framework Composer's default schema is not compatible with Power Virtual Agents therefore, it's always safe to start your activity of extending it from Power Virtual Agents.
<h3>Import PVA Assets to Bot Framework Composer</h3>
As I mentioned earlier, you must have Bot Framework Composer installed on your machine. Once you have that, clicking on Open Bot Framework (Preview) option will take you to the Composer. You just have to define your Bot's name in Composer and rest of the work will be handled by the process itself.

<img class="aligncenter size-full wp-image-31089" src="https://www.arafattehsin.com/wp-content/uploads/2020/11/ImportPVA.gif" alt="Import PVA with Bot Framework Composer" width="1916" height="968" />
<h3></h3>
<h3>Create a Trigger &amp; Dialog</h3>
Then, all you have to do is to define a trigger; a trigger is an action that gets executed when it meets a certain criteria. In this example, we're using Intent Recognized trigger. This means that whenever this specific intent is recognized from the utterance provided by the user, this will be triggered.

So what does it take to define an Intent Recognized trigger? You need to provide a name and the trigger phrases. Now, these trigger phrases can be written in an <a href="https://docs.microsoft.com/en-us/composer/concept-language-generation">LG format</a>.
<blockquote>Currently, PVA intent triggers do not support the ML entities such as {@account=savings} so please avoid using them</blockquote>
Once you're done creating the Trigger, you can just route it to the Dialog (see below ⬇). In the BeginDialog trigger, you can write your message that needs to be sent to your customer / user of PVA (once this intent is triggered). For the sake of simplicity (<em>extreme simplicity</em>), I have just written a message as <em>This message is from the Bot Framework Composer dialog.</em>

<img class="aligncenter size-full wp-image-31090" src="https://www.arafattehsin.com/wp-content/uploads/2020/11/CreateDialog.gif" alt="Create Trigger and Dialog from Bot Framework Composer for PVA" width="1916" height="968" />
<h3>Publish your changes back to PVA</h3>
Lastly, from the menu, click on Publish icon, choose your Publish profile and hit the Submit button! It will take some time but eventually, this will be published with the hyperlink to your Power Virtual Agent bot.

You can then see that all the changes have come through and test it in a similar way as I did.
<h2><img class="aligncenter size-full wp-image-31091" src="https://www.arafattehsin.com/wp-content/uploads/2020/11/PublishPVA.gif" alt="" width="1916" height="968" /></h2>
<h2>Some key takeaways</h2>
<ol>
 	<li>Unlike Bot Framework Skills, you do not need a separate license / Azure Bot Service registration to embed any of this functionality.</li>
 	<li>You can embed rich content such as Adaptive Cards without any hassle</li>
 	<li>You can also integrate with the natural language capabilities very easily from Composer.</li>
 	<li>Adaptive Expressions to accelerate your bot's logic.</li>
 	<li>Multi-select options for your customers</li>
 	<li>You can use Bing Search as a Fallback intent</li>
 	<li>PVA variables can also be accessed through Composer.</li>
 	<li>..and many more.. (<em>not explored by me..)</em></li>
</ol>
This has just gone LIVE so there's a lot to explore.. and at the time of writing this, I am confident that this is going to be a game changer for friends who're already creating Bots.

Until next time.