offline-directline | Unofficial package to emulate the bot framework connector | Plugin library
kandi X-RAY | offline-directline Summary
kandi X-RAY | offline-directline Summary
Unofficial package to emulate the bot framework connector locally.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of offline-directline
offline-directline Key Features
offline-directline Examples and Code Snippets
Community Discussions
Trending Discussions on offline-directline
QUESTION
I am currently looking at using Microsoft Web Chat to interact with my existing Node Js application built on MS Bot Framework Core but uses DialogFlow as NLU.
Current implementation: Web Page -> Custom UI Widget -> Connects to Node.js app built on MS Botframework Core -> Queries DialogFlow NLU to identify Intent -> Node.js app constructs the Dialog -> Gives response to user.
Looking at the Web Chat component, I cannot find references using any other NLU except Azure Bot Service. Is it mandatory to use Azure Bot Service/LUIS NLU to integrate with Web Chat?
I have also looked at offline-directline npm module but the last dev on the module is more than 3 years ago.
...ANSWER
Answered 2022-Mar-17 at 22:25Firstly, responding with a quick message about using offline-directline, you should feel reasonably comfortable with it. It is a few years old, but seems to stand the test of time with continued use and little in the way of issues that I have heard.
Another option would be to use a 'browser bot'. In this scenario, the bot is contained within the hosting page's html/scripts. So, there is no reliance on using Direct Line. I don't know your whole setup, so this may or may not align with your overall needs and architecture.
As for using Web Chat with something other than the Azure Bot Service, this would be an uphill battle. In theory, this is probably achievable to some degree. The issue is that Web Chat is heavily integrated with the BotFramework-DirectLineJS library. You might be able to cherry pick specific components from Web Chat, replace the Direct Line library with a make of your own, and modify the remaining code to work with your 'service'. But, I'm not certain the effort is worth it. That is something you would have to decide for yourself.
If you do go this direction, you will likely need to configure your 'service' to send messages that conform to the BotFramework schemas when communicating with Web Chat. Even without the dependency on Direct Line for connecting to the service, much of Web Chat is still oriented towards what an incoming message looks like (i.e. a BotFramework Activity) and handling it according to the properties it contains.
To start, here are a few areas you should review in order to correctly configure you service to handle inbound and outbound messages going to and coming from Web Chat:
- BotFramework Activity schema
- BotFramework Card schema
- BotFramework Transcript schema
- Web Chat's Activity, Card, Attachments, etc. Types - at present, these are loosely defined. I would expect that to change at some point in the future which may prove to be a changing break in your specific scenario.
This is not exhaustive and would require greater research as there are likely other considerations than the few I've listed above. But, again, this may not be necessary if you decide to utilize offline-directline.
QUESTION
After successfully connecting my locally hosted (botkit-based) bot to Microsoft's Bot Framework Emulator (using a localhost address for the messaging endpoint), I'm now trying to connect it to the framework's webchat (using an ngrok's hostname for my local bot). However, I get an 'unauthorized' when webchat tries to connect. More on my bot:
- The bot integrates with the Bot Framework via botkit's own Botkit Framework Adapter (see https://github.com/howdyai/botkit/blob/main/packages/docs/core.md#using-bot-framework-channels for details) *The bot is hosted locally (dev version, which is the one I'm trying to test), and exposed via ngrok. Its production version will be hosted on AWS.
Here's what I've tried so far:
- Using methods #1 and #2 described in https://docs.microsoft.com/en-us/azure/bot-service/bot-service-channel-connect-webchat?view=azure-bot-service-4.0 to embed the webchat using an iframe with the provided webchat secret and also a token (obtained separately via POSTMAN).
- Using a modification of method #3 in the same web page, in which I obtained a Direct Line token instead (via POSTMAN) and then tried to use it in the html provided in there.
- I've also tried 'Test in Web Chat' in the Azure console.
In all those cases my bot's own log displays the same: "Experienced an error inside the turn handler Error: BotFrameworkAdapter.processActivity(): 401 ERROR Error: Unauthorized. Invalid AppId passed on token: blah".
The browser console shows different results for the last case compared to the website embeds as follows:
- (website embeds), I see a 502 in the browser's console, which I believe is expected given the 401 response from the bot (as explained by other sources).
- (Test in Web Chat'), I see several other errors in the browser web console in addition to the 502. One of those errors makes me think that perhaps 'Test in Web Chat' does not actually support non-Azure hosted bots (MsPortalFx/Base/Base.Net Base.Net: Security issue: Request to send auth token to untrusted domain 'myngrokhostname.scm.azurewebsites.net'. Only a fixed set of domains should be configured to receive auth tokens).
So here are my immediate questions:
- Does the 'Test in web chat' feature require an Azure-hosted bot?
- Given that I don't specify myself an appId and password when configuring the webchat channel (since it gets automatically configured), how could I be getting an error indicating that the wrong appId is being used? (note: the appId and password are part of the bot's adapter configuration as explained in the link I shared earlier; this is the only spot in which I entered them, and they were copied directly from the AzureBot configuration console)
Aside from the above questions, do you have any other suggestions on what could be wrong/missing in my environment? BTW, by now I believe I have read all of the similar posts that refer to 'unauthorized' errors while using webchat and none of them has helped so far, including those referenced in the first comment provided below. For the record, here are the posts (not mentioned in the comment) that I've also read:
- There was an error sending this message to your bot - Test in Web Chat
- Test in Web Chat typing message returns "Not found" HTTP status code after deploying bot to Azure
- Getting a 403 while connecting local bot to local WebChat client (works with Emulator though) (note: a comment in the last post suggests that I should be looking into offline-directline to get this to work; I may try this although I don't understand why it should be needed). Any further help would be much appreciated.
ANSWER
Answered 2022-Feb-03 at 12:27• I will suggest you to please check the below Github community forum for details on your issue regarding the turn handler and the ‘BotFrameworkAdapter.processActivity():401 ERROR’ in which they state that they tried to connect through two types by local bot: -
- By entering the URL, appID/password
- To select the bot which is defined by bot file from "My bots" form in the Welcome section.
In the above two types of connections made, the 1st one always fails while the 2nd one executes successfully always. So, according to them, they are suggesting downloading the latest version of Emulator over.
https://github.com/microsoft/BotFramework-Emulator/issues/1417
Kindly refer to it as it may be helpful to you. And as far as ‘Test in webchat’ feature is concerned, it does require an Azure hosted bot because the Bot Framework Emulator that runs on the local device has the Azure Bot service endpoint link embedded in its runtime configuration for which during the execution of the emulator, we have to enter the AppID and password of the Azure Bot service to connect to.
https://docs.microsoft.com/en-us/composer/test/test-bots-in-web-chat
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install offline-directline
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page