How to run WebChat locally and talk directly to the locally hosted bot?
Hi, is WebChat able to (emulate BotConnector services and) talk directly to the locally hosted bot?
Right now, I'm talking to my locally hosted bot, but I have registered it and exposed it to outer world via ngrok. What should I change to enable this? Dan Driscoll mentioned something like unhooking security.
@billba Thanks for the correction.
Hi , Anyone has got any solution for this. I am struggling with the same issue. I want to connect bot with my custom chat window UI.
@siddiq-rehman @abhishan @billba Even I am Struggling with the same issue to enable bot completely private to organization. If someone finds a solution pls do share ..
Does anyone find a solution at this time ?
I think no one able to find solution for this so far...
Any solution found for intranet bots
I have achieved this (testing local webchat on local hosted bot). To do this, you need to:
- Run ngrok locally.
- Log into dev.botframework.com, and update the API callback URL of your bot to https://ngrock.io:xxxx/api/message
This will route your chatbot UI back to your localhost instance :)
Dear soonwonng
Good that you have achieved it. Could you please share some code or steps to configure this.
Thanks
Amazing, Great stuff soonwong, could you please elaborate or have any reference WEB URL which I can follow to run the ngrok... Thanks
Righto. On my local computer, I do the following:
- Configure my webchat front end to be hosted on IIS. (e.g. https://localhost:80).
- Configure my webchat to use the direct line API.
- Configure my API to be hosted on IIS. I ensure that a binding to https://localhost:1234 works. Note the port number is arbitrary, I wanted it to be not port 80 to be certain of connectivity.
I then locate ngrok.exe (you will have it if you have successfully set up the BotFramework Emulator). I run the command ngrok http 1234. This will open up a tunnel via ngrok to https://localhost:1234. Use your preferred port number.
I then log on to the https://dev.botframework.com portal:
- I locate my bot
- I configure the bot settings
- I change the endpoint URL from https://mybotinazure.com/api/messages/ to https://xxxxxx.ngrok.io/api/messages/
Presto!
Before this is done, your web traffic will look like: user -> webchat -> directline -> botframework -> bot API -> botframework -> directline -> webchat -> user
After this, it should look like: user -> webchat -> directline -> botframework -> ngrok -> localhost -> ngrok -> botframework -> directline -> webchat -> user.
Geat work and nice way of telling the steps.... only one thing... how secure is it to expose the local intranet to internet thru ngrok? does it provide any security features?
This should only be done for debugging a development environment. The tunnel will only be running so long as the command line instance of ngrok is running. If you're going to be deploying a production instance of the bot onto an intranet, you will need to find another means of connecting your bot to the botframework in Azure.
@soonwong, @maheshksingh @mohdkhan786 I've created an unofficial testing package that allows you to emulate the connector locally:
Hello Ryan.. I am still struggling to get a proper solution.. Could you please elaborate your solution please... Thanks for the help...
have you checked out the readme? If you're not a node guy it might be a bit confusing. If you have node running on your computer you can npm install this package and run the directline command mentioned in the readme, passing in the port where you want to host your connector and the endpoint where your bot lives.
@maheshksingh The right place to ask questions about Ryan's solution is that GitHub repo: https://github.com/ryanvolum/offline_dl
Hello Ryan Thats great... My problem is that my bot is in. Net. Will your solution works for. Net bot also or only to node bot?
For me it is getting error when I run npm run directline 3000 localhost://127.0.0.1:3979/api/messages
May be because of firewall in company. Is there any alternative to install this with firewall.
I tried with setting proxy as well but no success
@mohdkhan786 again, please go to that repo to ask questions. This repo is for WebChat itself.
another option is implement a customer middle ware, which replicates direct line protocol. you can point to your own implementation of directline protocol