Warning: This document is considered deprecated and will be updated soon.
Disclaimer: There is no C# (.NET) version of this sample, one could be built using a similar process using the C# API.
You need the following prerequisites:
- A Microsoft Dynamics Trial or Account
- A Live Assist for Microsoft Dynamics 365 Trial or Account
- A Microsoft Azure subscription
Before running this sample, we recommend that you work through the following topics:
Once you have a QnA bot up and running, and connected to Live Assist, you are welcome to use or modify the code in the example below. The walk through and the comments are here to help guide you through the implementation.
Step 1 - Create a QnA bot using the Microsoft QnA Maker.
We recommend that instead of creating a 'Basic' bot, as described in the Quickstart topic, you select a Q&A bot, and from the list choose the bot that you built from the AI earlier.
You can either enter your own questions and answers, or enter a URL to a page of FAQs to use to train your bot, if you prefer. This results in you having a boilerplate NodeJS app, similar to the one below, which you can then extend to offer transfers to Live Assist agents (that is, people), and to force transfers for particular responses or situations.
Step 2 - Update
app.js to extend and modify QnA Dialog and Implement Live Assist Dialog (offer_transfer)
app.js you need to extend the QnA Maker dialog, basicQnAMakerDialog.invokeAnswer, to include a custom function for the case where no FAQ answer is found. For this, the sample here implements its own noMatch function, which starts an offer_transfer dialog from the bot—if you are using the 'Consumption' model in Azure, and if you don't have custom requirements, you can replace the existing code with the code in the snippet below to make it work,
The offer_transfer dialog implements a BotBuilder confirm prompt, which with a positive response sends a direct line transfer message to Live Assist, targeting the pre-configured agent skill, set as the string constant transfer_skill.
See also: Bot Agent Connector - API
Step3 - Implement and use force_transfer dialog
In this sample, in the case where the QnA dialog receives a matching response, responses that end with a trailing /t skill cause the bot to respond with a force_transfer dialog, targeted at the skill appended to the end of the answer after the /t.
Within the root dialog of the bot, there is a switch statement that includes the otherAgentMessage case, which when invoked by, for example, a supervisor whisper causes a force_transfer dialogue targeted at the skill whispered by the supervisor.
Note: The example code snippet included below has a dependency on using the 'Consumption' model for the Azure bot service license. If you use the other license model, it creates a 'web app' which has a different file structure, and fails when you update the code using the provided snippet.