A sample for live human handoff/transfer of conversation from user using Microsoft Bot Framework.
I have written a blog post explaining the solution - https://ankitbko.github.io/2017/03/human-handover-bot/
-
Create a Luis app by importing
LuisModel\AgentTransfer.json
.
The bot uses Luis to understand if user wants to talk to an agent. If you don't want to use Luis, I have included anEchoDialog
class which would also work. You will need to modify the code to startEchoDialog
instead ofTransferLuisDialog
when message arrives (left as exercise to the reader). If you do this, go to step 3. -
Get the ModelId and SubscriptionKey of the Luis App and paste it into
LuisModel
attribute inTransferLuisDialog.cs
. -
Run the solution by pressing
F5
. By default, it should start at port 3979. If not, note the port it runs on and stop debugging. -
We will use ngrok to debug the bot locally. Download and run
ngrok
using commandngrok.exe http --host-header=rewrite <port number>
. Copy the Forwarding URL (https) which is genrated by ngrok. -
Register a new bot in Bot Framework Portal using URL generated by ngrok. Copy the Microsoft App Id and App Password and paste it in
web.config
. -
Agent Dashboard uses Direct Line as a channel. So, enable direct line and keep its Secret Key handy.
-
Run the solution once again.
To open Agent Dashboard go to http://localhost:3979/agentdashboard/index.html?s=DIRECTLINE_SECRET_KEY. Change the port number accordingly if it is not 3979. Notice the query string ?s=
. Enter the Direct Line secret key as the value of the query string.