I have been talking through how I created a chat bot that I built using Power Virtual Agents to talk to my quarantined parents. We have already looked at how to get started and how to use sentiment analysis to customize responses. Today we are going to set up an appointment!
Getting the TIme
The first step is to figure out when the user (aka my dad) wants to talk to me (aka all the time but that is beside the point). Power Virtual Agents has an option to collect a Date Time. This is super cool because it does recognize text entries, such as “next Monday” and converts to the correct date and time value.
In addition, I set it up to pass along the previous answer of which parent the bot is talking to so that it will know which email address to send the meeting invite to without needing ask who they are again. This makes the bot a bit easier to use (as I am not asking for the email address) but it does make the Flow less reusable due to the hard coded email addresses. The ability to collect more data like email address for more use case flexibility is an enhancement planned for a future release, possibly, Bored Trapped Parents Chat Bot 2.0.
Connecting to Power AUtomate
As we looked at previously, when you call an Action from Power Virtual Agents it will create the template in your new Flow. This template has a step to receive the data from Power Virtual Agents and a step to return output. For my other use cases, my actions would go between those two steps but this is not required.
I wanted to send an appointment approval based on the information gathered from the bot. This cannot be approved while someone is waiting for a bot to respond as it would time out and creates a poor user experience. Instead, we can return back to Power Virtual Agents before we send the approval. This allows the bot to keep running while the approval and following steps process.
Now we are going to get approval on the time. This is using the out of the box Power Automate Approvals functionality and we are including the Date Time that was captured from the Power Virtual Agent.
If approved, a meeting invite is sent back to the appropriate parent. If not approved, then an email is sent to tell them not to expect an invite but I will talk to them soon.
And that’s it! The conversation in the bot is still moving along while this approval is going on and everyone is happy.
I am going to finish this series off tomorrow talking about how to review the sessions and share reactions to this bot.