Updated: Mar 10
"Do you Bot Framework take Power Virtual Agents in sickness and in health, till death us to part?"
You bet I do!
Remember those matches made in heaven?
Cheese and Marmite
Morecambe and Wise
Fred Astair and Ginger Rogers
Peas and Carrots?
Well, there is a new partnership on the block, and they are tearing up the couple charts together.
Power Virtual Agents and Microsoft Bot Framework Composer!
Seriously, what a duo.
I LOVE Power Virtual Agents. I mean I really love it, but like all affairs (don’t tell my wife), there are bumpy points in the road.
I have recently been working with Power Virtual Agents and I have come up against an issue where I could not achieve what I wanted to do.
From the outside, the problem seemed simple:
Ask a question with a yes/no choice of answer and if the answer was yes, then ask another question to get the information and then save the information to a variable.
I looked at Power Automate to try and achieve it, but it just got too complicated and would have been hard to support.
I then clicked on the New Topic button, and I saw a little down arrow and it said, “Open in Bot Framework composer”.
This is where my love affair was rekindled, and I was soon in adaptive card heaven and branching on cases and all sorts.
It was a steep learning curve, I am no coder. But you can make adaptive cards at https://adaptivecards.io/designer/ and just copy and paste the code over and use it in a bot response.
There is a lot to Bot Framework Composer. I’m only touching the surface. But it’s a game change for bot development.
What is great as well, is that you’re able to validate the inputs that the user makes, and it’s all Power FX formula syntax. So, if you are used to building canvas apps or using expressions in Power Automate it’s a similar experience.
One of the other key areas are scopes. The main ones are:
The user. scope allows for variable names to be set which can then be used to save information against them.
For example, say I have an adaptive card that captures Name and email, and I have set the ids to these values inside the adaptive card code as Name and Email
I can assign these to user.Name and user.Email respectively by giving the variables those names (user.Name and user.Email) and then for the value use the turn.activity.value scope to assign the Name and Email address.
The other type of scope is dialog.result. Here you declare output variables on the topic that you are building and then later in the bot framework flow you can save your responses to the dialog.result scope and these will then pass those values saved back to the Power Virtual Agents topic.
After you have published the bot back to the cloud, you can jump back in to Power Virtual Agents, and you can then use the topic that you have just created by redirecting to it from another topic. When you choose the Bot Framework topic to redirect to you will see the variables being passed back to the topic from the Bot Framework step.
Only scratching the surface as I said here, but it truly is neat !
Edited to add: Solution - missing dependencies
I wanted to write an update to this post, just to explain a step that is vital if you are exporting and importing your chatbot solution across environments.
When you are ready to export the solution, go to your chatbot component and click the ellipses and select "Add Required Subcomponents". This will add all the bot components you have created in Microsoft Bot Framework Composer to your solution.
If you don't do this, when you try and import the solution in another environment you will get a "Missing Dependencies" error and you won't be able to import it.