The Bot Agent Connector allows you to develop bots as Live Assist for Microsoft Dynamics 365 agents.
- Microsoft’s Bot Framework only supports bots using the Direct Line connector.
- These bots handle visitor chats as if they were agents and may transfer to another agent or skill group when you require.
This article assumes you are familiar with:
- The Microsoft Azure Bot Service
- How to register Bots against your Live Assist for Microsoft Dynamics 365 account by Creating a Direct Line Channel Connector.
- Accessing the Live Assist Demo Site
- How to Enable Chat on Your Site
- Live Assist Engagements
The bot in this article simply replies to any chat messages that the visitor sends to the bot.
The engagement targets a specific skill group, to isolate the bot from other agents in your organization. When the visitor sends transfer to human, the bot transfers the chat to the skill group human with human agents in it.
To produce Bots as Agents you need the following:
- A Live Assist for Microsoft Dynamics 365 Enhanced License.
Each bot can handle 3 concurrent chats for each Live Assist license allocated.
- A Microsoft Azure Subscription, with access to the Azure Bot Service.
Register for a free trial.
Important: This article demonstrates Microsoft's Web App Bot. If you are deploying a Function Bot, the surrounding code samples may need alteration.
Configuring an Engagement
To prevent chat bots mixing with your human agents you configure your engagements for chat bots, with their own skill group.
Creating a QnA Web App Bot
Microsoft provides guidelines for producing a QnA Web App Bot.
See: Create a QnA Bot with Azure Bot Service
Apply Live Assist Code
The sample at https://github.com/CBA-LAD365/la-kb-snippets/blob/master/C%23_QnA-maker-bot_v4/QnABot.txt does the following:
1. Overrides the Bot SDK ActivityHandler classes OnTurnAsync method to handle all Live Assist ChannelData types received in the Direct Line channel except the visitorMessage type
2. In the existing OnMessageActivityAsync when the bot receives a visitorMessage via the Direct Line Channel Data. The sample:
- Checks the message begins with the String "transfer to " (This is the wording to signify that the visitor wants to be transferred to an agent with the following skill, In the sample case this is the 'human' skill)
- Create a Live Assist Channel Data object
- Post the Channel Data back to Live Assist to initiate the transfer
- Otherwise, allow the default QnA code to handle the message
3. Defines a LiveAssistChannelData object
- Bot Agent Connector—API for a full list of Live Assist Channel Data types.
- The Agent Enabler API documents provide a full list of Channel Data objects.
Creating a Direct Line Channel Connector
See: Creating a Direct Line Channel Connector
Testing your Bot
Your bot is now ready to test with your Live Assist for Microsoft Dynamics 365 engagement.
You can use the trial engagement. If you do not have, create a new one:
- The Visitor begins the chat:
- When the User enters: "transfer to MySkill" (in the sample code, it's"transfer to human"), the chat is routed to the MySkill(human) Group and an agent Agent answers it:
Debugging Web App Bots
There are numerous ways to debug your bot application.
See the following Microsoft documentation:
- Diagnosing runtime issues with the Failed Request Traces option.
- The Kudu Console also provides access to the file system where logs are written.