BotFramework-WebChat | customizable web-based client | Bot library
kandi X-RAY | BotFramework-WebChat Summary
kandi X-RAY | BotFramework-WebChat Summary
A highly-customizable web-based client for Azure Bot Services.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Creates a new representation of the audio payload .
- Initiate mock token .
- Play data from audio stream .
- Creates a multi buffering of audio buffers .
- Provides a Controlable event .
- Create a task Queue
- Create the default card action handler
- Main function
- Patch Reconnector .
- Update the activities for a particular activity .
BotFramework-WebChat Key Features
BotFramework-WebChat Examples and Code Snippets
Community Discussions
Trending Discussions on BotFramework-WebChat
QUESTION
I am attempting to proof of concept a simple support & ticketing bot using Microsoft Bot Framework v4 and Azure. I have successfully created a bot via the Bot Framework Composer and deployed it to Azure using a Web App Bot. I have configured and installed the BotFramework-WebChat component on my test site and successfully connected the bot to it. The BotFramework-WebChat component is installed via cdn.botframework.com. The test site is a single page application and the bot sits alongside this such that it can be accessed at the users convivence.
Everything is working as expected. I would like however to post certain contextual information to the Bot depending on the current browser state. For example, if a user is looking at product ABC when they converse with the bot I'd like the bot to know this. To achieve it I'd like to update the user state on the bot channel, preferably via vanilla JavaScript when the main application state changes. I'd like to do this seamlessly in the background and I do not want to rely on additional frameworks such as React (the Microsoft Documentation references React heavily and I unfortunately have no understanding of the particular product so find it difficult/impossible to follow).
My question is therefore in two parts. Is the above possible using the API provided by the BotFramwork-WebChat component and if so how would one go about doing so? If it is not possible I would also appreciate any assistance on alternative methods should such alternatives exist.
...ANSWER
Answered 2021-Mar-02 at 14:11If you just want to capture information at the time the user renders the webchat session, you can do this by sending a custom event, which you'll also need to handle in your bot code. This specific code will not work if you are trying to create a single instance of the bot that persists across multiple pages, and you are wanting the page details sent every time, but the same concept should apply. This method sends the details only on the initial connection to the bot.
First you need to send an event from your bot rendering via custom store. Here is how I did it.
QUESTION
I have created a Microsoft bot framework using this tutorial. I created a chatbot using this javascript. I need to Enable/Disable the attachment button based on the bot message. My condition is to Enable the attachment button when the bot sends a message to the user to submit the attachment.
Html:
...ANSWER
Answered 2021-Mar-12 at 02:48You can accomplish this by filtering the activities that pass thru Web Chat's store. As you can see below, I first query for the attachment button's elements - there are two, a hidden input field and the button.
Next, I check if the activity has an attachment and if that attachment's contentType
matches "application/vnd.microsoft.card.adaptive". If it does, then the attachment input & button is enabled. Otherwise, the attachment input & button is disabled for all other activities.
The whole if statement is wrapped in a time out. This is necessary because the check on the contentType
of the attachment will complete before the store has finished rendering the activity resulting in a persistently disabled button. Setting a time out of ~300 ms allows the store to complete its rendering action. You can adjust the time out, but less than ~50 ms and the above will start occurring. Longer than ~500 ms and it will start to be noticeable to users.
Please note, isolating the input & button elements relies on attributes and classes defined by Web Chat. While it is unlikely to be an issue, it's possible those definitions could change in future releases resulting in breaking changes and requiring updates to your code.
QUESTION
I'm currently sending a text programmatically to my bot following the article on https://github.com/microsoft/BotFramework-WebChat/tree/master/samples/04.api/d.post-activity-event
Everything is working fine but I want to hide the text being sent so that the user does not see it on the session. Is this possible to do?
...ANSWER
Answered 2021-Feb-25 at 10:31Instead of initializing and using the useSendMessage
hook, replace it with useSendPostBack. Using useSendPostBack
will generate a postBack
message activity which simply sends a value back to the bot without displaying it to the user. The value sent to the bot should be located in the value
property of the associated activity.
QUESTION
Is there a way to use styleOptions when rendering the Web Chat when using ReactJS?
I can see that it is supported as a hook as per https://github.com/microsoft/BotFramework-WebChat/blob/master/docs/HOOKS.md#usestyleoptions but there is no instructions to implement it.
Thanks!
...ANSWER
Answered 2021-Feb-08 at 12:06I was able to get it to work using the below code:
QUESTION
I'm trying to integrate botframework-webchat to a gatsby.js website, gatsby develop builds successfully, however when i run the production build using the command gatsby build, it throws the following error.
...ANSWER
Answered 2020-Dec-24 at 08:57I've been aware of you have followed up the suggested link https://www.gatsbyjs.com/docs/debugging-html-builds/#fixing-third-party-modules to fix window
issue.
BUT it this way is likely to prevent webpack
compile the commonjs
web chat packages properly which ended up with the issue.
I was also aware of the configuration the stage of build-html
isn't called during dev
that's why you wouldn't see the error as you yarn start // gatsby develop
.
However, the document also suggests another way to fix is to use code splitting technique by using loadable-component
. Personally, I think this way is best for you project since the chat is supposed to be rendered at the client side only.
Here's a few thing you would change:
- Remove your configuration in
gatsby-node
:
QUESTION
I need to hide the secret for direct line channel using an HTML webchat, tried this solution but keeps getting me errors while fetching. I got the secret for direct line channel in Azure portal in process.env
Index.js
...ANSWER
Answered 2020-Oct-27 at 02:37The issue with your particular implementation is, while you have set up an API for generating and serving a token back to Web Chat, you are failing to actually call that endpoint. Instead of
const res = await fetch('https://directline.botframework.com/v3/directline/tokens/generate', { method: 'POST' });
you should have
const res = await fetch('http://localhost:3978/directline/token', { method: 'POST' });
It is this that will make the call to exchange the Direct Line secret for a token and, in turn, will return the token back to your Web Chat instance.
QUESTION
I´m rendering my chat using this:
...ANSWER
Answered 2020-Sep-25 at 08:38I think your best bet going forward is to use the samples provided by the webchat team. The minimizable webchat sample is a good example.
QUESTION
We have recently switched over from WebChatV3 to V4. As an ongoing effort we're porting all our custom functionality to the new client. One of those functionalities is checking URLs for a specific domain and setting the target on the a tag to "_parent".
To implement this we've added a dependency to markdown-it, since the ReactWebChat element can take it as an argument as described here: BotFramework-Webchat Middleware for renderMarkdown Instead of adding an emoji renderer, we've built a rule into it and passed it into ReactWebChat as per the example given in the answer above. That code looks like this:
...ANSWER
Answered 2020-Sep-10 at 00:57Because Web Chat converts all cards to Adaptive Cards, you will need to solve this issue using Adaptive Cards. You can see here that the Adaptive Cards SDK that Web Chat is using converts all anchors to "_blank" after Markdown is applied.
QUESTION
We have a bot running in Azure (Web App Bot) that I'm trying to embed on a website. The bot is based of the Bot Builder V4 SDK Tamplate CoreBot v4.9.2. At first I used the iframe
to embed the bod. This worked but didn't provide the features we need, so now im changing it to use DirectLine.
My code on the webpage looks like this:
...ANSWER
Answered 2020-Sep-03 at 01:02If the ib and ob values displayed by the *.bot endpoint are false this means the bot and the Direct Line app service extension are unable to connect to each other.
Make sure you verify below things:
- Double check the code for using named pipes has been added to the bot.
- Confirm the bot is able to start up and run at all. Useful tools are Test in WebChat, connecting an additional channel, remote debugging, or logging.
- Restart the entire Azure App Service the bot is hosted within, to ensure a clean start up of all processes.
Please check troubleshooting guide, it seems updated today. (still old date reflected some how, not sure why)
QUESTION
We are migrating from BotFramework-Webchat v3 to v4. Usually we send a message from the chat through the directline object created from v3 BotChat using the directline.postActivity function. However in our v4 implementation there were issues with the behavior of messages shown in the chat window when posting activities like this.
It seems that sending messages through the webchat redux store as shown in this example is the recommended approach.
I am wondering what is the difference between these two usages? It seems something is different between v3 and v4 versions and I am having difficulty finding references in the documentation about this. Should directline.postActivity be avoided completely?
...ANSWER
Answered 2020-Sep-02 at 23:45It isn't documented anywhere, but best practice is what is demonstrated via the samples, by use of the Web Chat redux store and its list of available actions.
Essentially, Web Chat v4 is built on top of BotFramework-DirectlineJS which does use observables. Web Chat then translates the Direct Line observables into its own methods for consumption internally and by the user.
As you noted, it is possible to use the Direct Line observables in Web Chat but it is neither the best method nor the best practice to do so. Primarily, because Web Chat wasn't specifically designed around their use, except internally. It can work, but it opens you up to potentially curious behavior.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install BotFramework-WebChat
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