Reputation: 51
enter image description hereI have created the MS Bot application using C# with LUIS for Intents recognizing. I want to add the chat UI in my own sample Asp.Net web application. I've not used Azure services, simply i have used user Intents recognizing for LUIS service and developed the MS Bot with C#. How to integrate or give new UI for Chat bot using my own web application.
Upvotes: 1
Views: 3869
Reputation: 8292
Option 1: hosted webchat
Be sure to exchange the direct line secret for a token before returning the page to the user. The secret should never be shared. More information can be found here: https://learn.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-direct-line-3-0-authentication
<!DOCTYPE html>
<html>
<body>
<div id="webchat" role="main"></div>
<script src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script>
<script>
window.WebChat.renderWebChat({
directLine: window.WebChat.createDirectLine({ token: 'YOUR_DIRECT_LINE_TOKEN' }),
userID: 'YOUR_USER_ID',
username: 'Web Chat User',
locale: 'en-US',
botAvatarInitials: 'WC',
userAvatarInitials: 'WW'
}, document.getElementById('webchat'));
</script>
</body>
</html>
Option 2: iframe
Once you've registered a Bot Service in Azure, the easiest way is to add the iframe embed code to the <body>
in the default.htm file created by the Bot Application template:
<body>
<iframe src='https://webchat.botframework.com/embed/YOUR_BOT_HANDLE?t=YOUR_WEBCHAT_TOKEN' height="400" width="400"></iframe>
</body>
Be sure to change YOUR_BOT_HANDLE and YOUR_WEBCHAT_TOKEN to match your own.
Then, when you run the project, the page that is displayed will show the webchat control connected to your bot.
Upvotes: 1
Reputation: 16652
You can separately develop your bot application and your asp.net application. And to embed your bot into your web application, you can use Direct Line API.
For example, after publishing your bot, you can Connect a bot to Direct Line, the easy way is to use IFRAME in your web pages for example:
<iframe src='path to your bot with SECRET key or token' height="height" width="width"></iframe>
For more information, you can refer to ReadMe of Microsoft Bot Framework Web Chat.
Upvotes: 1
Reputation: 51
Here you can see the Message controller which is startign point of the Application from here only it starts. here only we are sending and receiving the responses of a user.
Upvotes: 2