How to use Virtual Agent (bot)

Recently for one of our customer I developed a Virtual Agent (bot) which will ask basic details like First Name, Last Name, Company Name and Email Id for the Portal Registration and at the end it will save the data in CDS. Follow the below steps to develop a simple bot

Step 1: Create a new trail instance here (as of now Virtual Agent preview is only available for United States region)

Step 2: After the trail instance is created, create an Entity to save the portal registrations data. In my example, I created an entity called “Portal Registration” with the below fields

  1. Last Name
  2. First Name
  3. Company Name
  4. Email Id

Step 3: Create a MS Flow. We will integrate this flow with bot in the next steps to save the data in “Portal Registration” entity. Please note, you have to create a Flow in “Common Data Services Default Solution”, otherwise bot can’t access this Flow.

The trigger for the Flow should be “When a HTTP request is received”.

The Request Body in this example should be like below.

{
“type”: “object”,
“properties”: {
“lastname”: {
“type”: “string”
},
“firstname”: {
“type”: “string”
},
“companyname”: {
“type”: “string”
},
“email”: {
“type”: “string”
}
}
}

Step 4: Go to your Virtual Agent Preview instance (https://va.ai.dynamics.com) and create a bot. Use “Bots panel” button

on the top right navigation to create a new bot. Provide bot’s name and click on Create.

Step 5: After bot is created, you can add your own custom Topics. You will have some predefined Topics available once the bot is created which you can use for your reference.

In my case, I created “Portal Registration” Topic. You have to specify some Trigger phrases to trigger a particular topic. In this example, when ever you enter any of the phrase that I specified in the below screenshot, the bot will choose my topic and start the conversation which we will setup in next steps.

Step 6: Once you click on Edit button, it will redirect to actual page where you should develop your conversation. Use “Bot Says” action to ask a question to the user and “User Responses” action to get the answer from the user, finally capture the user response in a parameter for further use. Repeat this for rest of the questions (First Name, Company Name and Email Id)

Step 7: At the end, we have to save this information in CDS. For this requirement we have to integrate a MS Flow with the bot. Use “Action” action and select the Flow that we created in Step 3 and pass the parameters to MS Flow

Step 8: At the end Deploy the bot on Demo Website and Publish it. Use the bot through URL which is generated after Publish.

Hope it will give you basic idea on how to use bot with MS Flow.