I have created an BOT with Microsoft BOT Framework and published in local IIS. Now I want to connect that from my web application, So far I found this could be only possible through direct line from azure portal. Is there any other way to do that?
Now I want to connect that from my web application, So far I found this could be only possible through direct line from azure portal. Is there any other way to do that?
In my opinion, the Microsoft BOT Framework application is just a service which provide the bot endpoint. You could host it in anywhere.
If you want to connect to your web application or something else. You need to use a channel to connect the bot with other application. You should register the bot and enable the channel to let your bot work. The Azure provide multiple chanels to register the bot like webchat. You could also build the channel by yourself, but you should think about a lot of things.
More details, you could refer to below answer:
How to connect local hosted Azure BOT from your web application
Related
I want to develop a product which simplifies the way of creating conversational chat bots using Microsoft BotFramework SDK. As we can build and host web application on-premise completely.
So can we build the similar thing using bot framework on a self hosted environment?
Here is the link for Microsoft Bot Framework: https://dev.botframework.com/
You can, indeed, build a bot entirely on-premises/self-hosted, provided that you don't need to connect to a Channel like Teams.
Background
Basically, bots communicate via:
User interaction with DirectLine Client (like Web Chat) ->
DirectLine API receives data and sends to bot ->
Bot hosted anywhere receives message
Note:
WebChat is just a DirectLine client. If you want to build your own WebChat, you can clone the repo and build it yourself. However, that all this does is make it so you can host your own webchat.js file, if you really want to be self-hosted.
Steps
With that in mind, all you need is:
A Direct Line client like Web Chat (specify domain property with your own endpoint when you call createDirectLine), or you can write your own client
You own DirectLine API implementation like offline-directline (more info)
Host your bot somewhere
Security
With this approach, you won't be able to use the typical appId/password setup.
You can manually implement our security protocol by following this document
Even though it is possible to manually implement the security protocol, we recommend reusing our existing open-source libraries
Based on answers, putting a more complete answer here. Since the option exists to have internet connectivity, I'd definitely suggest creating the solution as a "regular" Bot Framework bot, using the Azure Bot registration. Importantly, there are TWO options to do this - the most obvious one creates a "registration" for the bot but ALSO defaults to hosting it in an Azure Web App, which has a cost associated that can be quite significant. HOWEVER, there's another option, to create just a "Bot Channel" registration, which means you get a bot registered in Azure, but not necessarily hosted in Azure.
I've described this more in this post and you want to use the "Bot Channels Registration" in Azure, not the "Web App Bot". Then, on the "settings" screen you can define what the bot's actual address is (see here for a view of the Settings screen).
So, overall that should help - basically the bot just needs to have an HTTPS, internet-accessible endpoint. HOWEVER, that said, it's possible to host your bots inside Azure Functions, rather than Azure Web Apps, and the cost is dramatically cheaper (cents vs dollars, especially with low traffic). It's a bit of work, especially as the default samples default to the more standard options, but it works quite well.
I've recently launched a new blog, by the way, and I've got a post describing some of what I've learned so far about how bots work, that would be good to know as part of this. See How Bot Calls Actually Work.
We're in the process of migrating from an entirely on-premise solution with our own DirectLine server to Azure Bot Channels Registration because of the requirement for MS Teams integration.
We have set up the following network:
chatbot setup
Our internal chatbot is written in C#, and runs in .NET core linux env.
As of now, we are able to use the Bot Framework's Web Cmd to Send and Receive from our Internal Chatbot. But we are unable to use MS Teams to communicate with our Internal Chat Bot. We have set up App ID and App Password in the MS Team's App via App Studio.
We also enabled External App and Sideloading.
Is there any way to troubleshoot this? or is there something we may have missed?
Thanks in advance
As per this documentation, You need to also enable the Teams channel for your bot in the Azure Portal under Bot Management > Channels, for this to work.
A bot is essentially a web API and so it can be hosted on any web service.
I am abit confused when one of the following approaches should be prefered over each other:
Option #1 Host a Bot on Azure Bot Service
Option #2 Host a bot as a plain PaaS Web API
Currently I am hosting my bot on a plain Azure PaaS App Services. It is working very well.
However, I expect there must be some advantages to hosting a bot on Azure Bot Service.
When I go through the documentations the following example shows how to Create an Azure Bot Service in Azure Portal, download its code, change it then deploy it again to the same Azure Bot Service:
https://learn.microsoft.com/en-us/azure/bot-service/bot-service-build-download-source-code?view=azure-bot-service-4.0
In contrast, the following example shows how to build a bot in Visual Studio and publish it to an Azure Web App:
https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-howto-deploy-azure?view=azure-bot-service-4.0
What are the advantages of hosting a bot on Azure Bot Service?
Is there any resource or article that contrasts the two options?
They are essentially the same thing under the hood. A bot is basically just an API endpoint so there are many ways to host you bot. If you create A bot service you get options to add other services from the creation page. Whereas if you just create a web app or app service you will have to manually add these things.
Creating a Web App Bot will allow you to all in one step create:
Bot Channels Registration
Choose a template to start with
Configure a Luis app
Add Azure Storage
Add application insights
I have a bot created in Azure, and I want to know if it is possible to open channels for this bot without having to go to Azure, ie through Visual Studio or another tool.
Thanks in advance for the help.
Marcelo,
Unfortunately, you can only configure bot channels through the Azure portal. There are currently no options for automation, REST API, etc. More information can be found here
I want to know if it is possible to open channels for this bot without having to go to Azure
Azure bot service provides a way to easily and conveniently connect a bot to various channels, if you want to connect to the specific channel(s) without Azure, you can check if the specific channel(s) expose REST API for exchanging messages, and then you can try to write your own channel connectors that would take Activity objects and translate them back and forth into the specific channel's message schema.
Note:
1) This github issue discussed "Is it possible to use the BotFramework SDK to connect to channels (telegram, skype...) without need to pay any Azure service?", you can check it.
2) The Bot Framework Emulator works on local, you can connect to a bot running locally.
Is it possible to talk to my bot via WebChat like I'm doing it via Emulator, Without registering and publishing the bot on Azure?
You will need to register the bot in the BotFramework portal and enable the WebChat channel. Registering the bot doesn't mean that the bot will be published to the bot directory. You don't need to publish the bot to using it.
Also, you don't need to publish the bot in Azure to use it. Instead, you could use ngrok to create a secure tunnels to localhost.
You can check the following links:
https://docs.botframework.com/en-us/node/builder/guides/core-concepts/#debugging-locally-using-ngrok
https://robinosborne.co.uk/2016/09/19/debugging-botframework-locally-using-ngrok/
Update 21/12
Just remembered that since the WebChat is now open source, you might have an option to run it locally as described in the README.md. Below the relevant portion of the docs.