botbuilder-dotnet | Bot Framework SDK for .NET repository | Bot library
kandi X-RAY | botbuilder-dotnet Summary
kandi X-RAY | botbuilder-dotnet Summary
This repository contains code for the .NET version of the Microsoft Bot Framework SDK, which is part of the Microsoft Bot Framework - a comprehensive framework for building enterprise-grade conversational AI experiences. This SDK enables developers to model conversation and build sophisticated bot applications using .NET. SDKs for JavaScript, Python and Java (preview) are also available. To get started building bots using the SDK, see the Azure Bot Service Documentation.
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 botbuilder-dotnet
botbuilder-dotnet Key Features
botbuilder-dotnet Examples and Code Snippets
Community Discussions
Trending Discussions on botbuilder-dotnet
QUESTION
I'm working on a web socket wrapper around Binance's web socket stream. System.IO.Pipelines looks interesting to me because of the problems it solves.
I'm most likely going to take one of the following implementations:
- SignalR
- BotBuilder (not sure what exactly that project is)
- DotNet.Interactive.PowerShell
- a project that probably got inspired by Microsoft's implementation
I'm unable to understand what the difference between IDuplexPipe
and Pipe
is.
The IDuplexPipe is a contract for types that support both reading and writing. For example, a network connection would be represented by an IDuplexPipe.
Since the web socket wrapper I'm working on is related to Binance's web socket stream, I assume I need the IDuplexPipe
?
SignalR uses IDuplexPipe
and DotNet.Interactive.PowerShell uses onl the Pipe
class. Can you enlighten of what the difference between these two is with real life example, because I don't really understand what Microsoft's documentation states.
ANSWER
Answered 2021-Dec-10 at 13:12IDuplexPipe documentation:
Defines a class that provides a duplex pipe from which data can be read from and written to.
An IDuplexPipe is an interface that represent something you can Read from, using the PipeReader, and Write to, using the PipeWriter.
The IO.Pipelines Pipe is simply a buffer.
It's explained in the docs you linked: https://docs.microsoft.com/en-us/dotnet/standard/io/pipelines#pipe
The Pipe class can be used to create a PipeWriter/PipeReader pair. All data written into the PipeWriter is available in the PipeReader: The PipeWriter write the data into the buffer, and the PipeReader read from it.
QUESTION
I have written an Ms Teams Bot using the Bot Framework with .Net and I would like to identify the Owner of the Team in which the Bot is installed (e.g. to send them an adaptive card with more privileged features on it, rather than having the whole team see it).
the V4.9 release note of the bot framework states:
The TeamsChannelAccount object has been updated to include userRole (one of owner, member, or guest) and tenantId (for the user's tenantId)
Yet this seems to be incorrect. When using TeamsInfo.GetMemberAsync or TeamsInfo.GetPagedMembersAsync to retrieve member info (which all return the TeamsChannelAccount object mentioned above) the UserRole property only ever shows "user" as the value - never "owner" or otherwise.
How can I identify the owner of the team? Thank you.
...ANSWER
Answered 2021-Dec-03 at 19:40You could instead try to use MSGraph APIs to identify the Owner of a Group. Assuming you have the requisite permissions, you can make a GET
call to the appropriate Graph endpoint and it will return to you the owner's ID and name, among other things. You could then use the ID to identify the owner in Teams. MSGraph API calls for getting members also have a roles
field, and that can have owner in it as well.
If this solution could work for you, the Teams Auth sample is a good place to start.
Here are some potentially helpful docs pages as well:
QUESTION
I have a bot in C# working with botbuilder-dotnet using the slack-adapter with my workspace. Now I want to install the slack app in other workspaces. How can I configure the adapter to work with multiple workspaces? I think it's around this options in the constructor but couldn't find any examples: https://github.com/microsoft/botbuilder-dotnet/blob/497cb6e5192c85a82478aca475f324dd3afde4cf/libraries/Adapters/Microsoft.Bot.Builder.Adapters.Slack/SlackClientWrapper.cs#L214
...ANSWER
Answered 2021-Apr-22 at 22:58Currently, the Bot Framework does not support multiple workspaces as of 4/22/21.
You did the right thing by creating a feature request in the GitHub repo. For others who're searching for this issue and would like for it to gain traction, see link tracking the issue:
https://github.com/microsoft/botbuilder-dotnet/issues/5519
The Bot Framework team will look into and assign priority to, should they decide to implement the feature request
QUESTION
We have been using the bot framework for a while now and are very happy with it. We use the stepContext.Parent.CancelAllDialogsAsync()
method. This works fine but we want to pass a result or trigger some kind of action in the bot code. We would like to pass a value.
I noticed the optional eventName
and eventValue
parameters, but I cannot find any way to use them. I found this documentation for the method but the eventName
and eventValue
are not explained at all. https://docs.microsoft.com/en-us/dotnet/api/microsoft.bot.builder.dialogs.dialogcontext.cancelalldialogsasync?view=botbuilder-dotnet-stable.
I thought that it would trigger the DialogBot's OnEventActivityAsync
method, but it doesn't.
Our use case is as follows: At some point in the conversation our bot asks the user a question. When the user doesn't answer the question multiple times, but instead keeps asking their own question we call CancelAllDialogsAsync
. The bot will get back to the MainDialog and wait for user input, so the user will have to ask their question again. We don't want the user to have to ask agian, so we want to cancel all dialogs and go back to the MainDialog passing the users question so the MainDialog can pick a way to answer it.
Any help is appreciated.
...ANSWER
Answered 2021-Feb-02 at 12:56Our solution is to store the utterance in the user state. The MainDialog checks the userstate if an utterance is stored. If so it will answer it. No utterance is stored in the user state the main dialog it will ask the user 'What can I do for you?'.
QUESTION
I have been following the tutorial (Bot Framework Integrate Composer Into Skill Project) to integrate composer dialogs with a skill project. This includes composer created dialogs which call a skill. I am running into the exception "Value cannot be null. (Parameter 'uriString')" when calling the skill.
I ran into various other issues when setting this up, as outlined here Previous Issues, which have been resolved though I had to do a work around to get the settings to work. I now need to determine why the configuration settings are not resolving.
To recreate the issue use the "skill-setting-issue" branch of the repo Git Repo
Prerequisites
Install Bot Emulator:Bot Emulator Install Instructions
Open the solution file in visual studio Integrate-Composer-Dialog-Using-Skill.sln
Put a breakpoint on line 79 of DefaultAdapter.cs - this is where the error can be seen
Start debugging the project
Open Bot Emulator
Connect to the bot: http://localhost:3978/api/messages
Type "Greeting"
Bot should respond with "Hello, I have recognized that you said greeting" - This means that the composer dialog integration is working as expected.
Type "Skill"
The breakpoint on line 79 of DefaultAdapter.cs should trigger giving details of the error.
The error seems to be occurring because the settings values within Composer-With-Skill.dialog between line 52 & 57 cannot be resolved.
...ANSWER
Answered 2020-Dec-18 at 22:36Determined that the IConfiguration instance which was configured & created in the constructor of Startup.cs was not being used when dependency injection was happening on IConfiguration. This was causing the new configuration files added not to be available.
Added
QUESTION
I am working on creating a workflow which allows composer created dialogs to be integrated into a bot skill project.
To accomplish this I am trying to follow the instructions in this post: https://microsoft.github.io/botframework-solutions/skills/handbook/experimental-add-composer/
My composer created dialogs including calling a skill. When I initiate that intent through the Bot Emulator I get this error: System.NullReferenceException: 'Unable to locate SkillConversationIdFactoryBase in HostContext'
The setup to get to this error is time consuming so I have created a git repo which can be started fairly easily to demonstrate the issue.
The project can be found here: https://github.com/silverbulletgt/Integrate-Composer-Dialog-Using-Skill
To recreate the issue:
Prerequisites
Install Bot Emulator: https://github.com/Microsoft/BotFramework-Emulator/blob/master/README.md
Open the solution file in visual studio Integrate-Composer-Dialog-Using-Skill.sln
Put a breakpoint on line 72 of DefaultAdapter.cs - this is where the error can be seen
Start debugging the project
Open Bot Emulator
Connect to the bot: http://localhost:3978/api/messages
Type "Greeting"
Bot should respond with "Hello, I have recognized that you said greeting" - This means that the composer dialog integration is working as expected.
Type "Skill"
The breakpoint on line 72 of DefaultAdapter.cs should trigger giving details of the error.
Error & stack trace can be found here: https://github.com/silverbulletgt/Integrate-Composer-Dialog-Using-Skill/blob/master/Readme/error%20stack%20trace.txt
Edit: I was able to compile the Bot Builder code Bot Builder GitHub & connect it to my project so that I could debug. I found the error to be happening on line 157 of Microsoft.Bot.Builder.Dialogs.Adaptive.BeginSkill.cs code BeginSkill.cs.
This line is trying to get the SkillConversationFactoryBase out of the dialogContext.Context.TurnState. I'm investigating how I might add this so that it is populated when this code executes.
...ANSWER
Answered 2020-Dec-18 at 17:44- Fix: System.NullReferenceException: 'Unable to locate SkillConversationIdFactoryBase in HostContext' in Microsoft.Bot.Builder.Dialogs.Adaptive.Actions.BeginSkill
This error was being caused by missing dependency injection requirements. Added the below lines to Startup.cs
QUESTION
To pass values to some methods, you need to have object, that contains simple type fields.
Is there way to generate adhoc object and assign simple type (lets say string) to it, without defining a new class?
I have:
...ANSWER
Answered 2020-Nov-26 at 13:04In general, yes.
- C# 7 supports Value-Tuples (
System.ValueTuple
). - C# 3 supports Anonymous Types, though given these cause GC heap allocation I don't recommend using them. You also cannot use them in a method signature.
- You can also manually instantiate
System.Tuple
. - If you want to forgoe type-safety you can use
dynamic
, but this is not recommended.
However, in the context of your question (w.r.t. Microsoft.Bot.Builder.LanguageGeneration.EvaluationOptions
), because .NET uses nominative typing (rather than structural typing) you cannot pass Value-Tuples, Anonymous Types, or System.Tuple
to methods that expect objects of a particular type - you must still instantiate an object of the correct type yourself.
QUESTION
I am using Botframework adaptive dialog template (c#). I already obtained a token from a HttpRequest and saved it as a conversation state property conversation.token
, now I am trying to use this token to make another API call with HttpRequest. But from the official document of HttpRequest Class, it seems there is no options to add the authentication token. I tried to add the token in the Headers, but did not work, it showed 401 Unauthorized error. How should the authorization be handled in HttpRequest in adaptive dialog?
ANSWER
Answered 2020-Aug-08 at 14:46Instead of using HttpRequest, I made the API call inside CodeAction with custom code.
First make a POST request to get the token, then make a GET request to call the main API. In the GET request, the authorization can be added in this way: client.DefaultRequestHeaders.Add("Authorization", "Bearer " + accessToken);
.
QUESTION
I am developing a Microsoft Teams bot using Azure Bot service, I have a use case where I need fetch the @mentioned users AAD object Id and use this Id to get other enterprises specific user information.
I have tried to use turnContext object's, GetMentions()
API which returns Channel Account object, however, the AAD Object property of channel account is empty, though it has an Id property which I believe corresponds to the Bot Service channel's (Microsoft Teams) user.
Given my research, could someone please let me know how to fetch the users AAD object Id or point me to the right documentation?
...ANSWER
Answered 2020-Mar-19 at 09:18You could get the id of the user using Bot Context using the id you receive from GetMentions(29:id). Please try this code and let us know if you face any issues:
QUESTION
In the latest bot samples, we can see that bot is being added to services collection as below
...ANSWER
Answered 2020-Feb-05 at 18:48You can see in the source code that the AddBot
methods are used for automatically adding a bot adapter to DI in addition to the bot and for configuring bot-related options like credentials and error handling. The conventions for using the Bot Builder v4 SDK were very different when those samples were made, and the bot's configuration along with its credentials were loaded from something called a bot file. The current convention for using the SDK is much easier because it takes advantage of ASP.NET Core automatically loading the app's configuration from appsettings.json. Since we're not using AddBot
anymore you'll notice that the adapter is added to DI explicitly, and you can configure things like error handling and middleware either by accessing the properties and methods of the adapter directly or by deriving your own adapter class, as seen in the samples.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install botbuilder-dotnet
Open Microsoft.Bot.Builder.sln in Visual Studio. On the menu bar, choose Build > Build Solution. When the solution is built, local NuGet package files (.nupkg) are generated for each project and are available under the outputPackages directory. You can add this folder to your NuGet Package Manager source list in Visual Studio (choose Tools > NuGet Package Manager > Package Manager Settings from the Visual Studio menu and add an additional Package Sources from there), allowing you to consume these in your local projects.
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