I have created a chat bot using Bot Framework Composer, and I’m trying to get the plain text of the different conversation turns, for logging purposes.
I have found this resource, where it explains how to do it, but it only applies for the Microsoft Bot Framework v4 sdk.
However, since the code generated by Framework Composer and Bot Framework SDK is different I don’t know how to access the Activity object or the turnContext info.
Is there any way to access this info from the code generated by Bot Framework Composer?
I have tried printing from SkillController.cs and BotController.cs. However, the Activity object that might contain the turnContext is empty.
Follow the following steps:-
1.Ask for input text and than store it using "Set a property".
2.If you want you can give different variable names each time whenever you want to store user response.
3.You can use the variable name to access the response.
Here is the output:-
And you can also merge it in a loop for storing multiple response.
Write the custom middleware to access turn context object
here the video steps how to create custom middleware using bot composer
Related
I am having a BOT application which is being developed using Microsoft BOT Framework V3 and WebChat Framework V4. In one of the scenario where user sends a particular utterance say "I want to place an order" which goes to LUIS and then BOT replies users to choose some choice using PromptDialog.Choice(context,choiceSelection,message). E.g. "Home Delivery", "Self Pickup"
Now when user clicks on one of the button (Say "Home Delivery"), then technically the choiceSelection method should be invoked but instead of that BOT takes that choice as a new utterances and calls the LUIS to which no intent is mapped and hence the scenario does not complete
with expected result.
Also I have checked with using BOT WebChat V3 version, the scenario works absolutely fine without failing. But due to client requirement, I would like to go with WebChat v4 instead of WebChat v3 framework.
Any suggestions, work around will be highly appreciated.
You have two options to choose from:
Limit how and when utterances and selections are captured by LUIS so every response isn't getting processed. Or,
Provide a "none" intent. If you supply your training model with sufficient examples for getting correct responses, then unrelated queries should map to "none". Really, the emphasis is on "sufficient examples". If you don't supply enough data to train your model with, then you will certainly get undesirable results. Once you get the "none" intent to properly produce, you can set the logic in your bot to recognize "none" was returned and to keep on going.
In truth, both options together would serve you well.
As for Web Chat, it has no bearing on LUIS responses. It is merely a client that receives and returns activities. Out-of-the-box, it does nothing to the activities unless you implement custom components and code.
For clarity, there is no relationship between Botbuilder v3/v4 and BotFramework Web Chat v3/v4. They can be used interchangeably. However, Web Chat v3 (a.k.a. "botchat") is deprecated and should not be used. Web Chat v4 is the platform you will want to use.
Hope of help!
I am currently developing a Microsoft Teams bot using the Microsoft Bot Framework. It works perfectly fine in web chat, the bot emulator, and 1-on-1 for how we need it to work in Teams. However, once we side-loaded it into our specific team in Teams, we are getting undesired behavior. Some of our intents are being wrongly triggered or no longer working at all now that we have to #mention the bot to talk with it. For example, when the user says "#mention hello", the StopVM intent is being triggered rather than our Greeting intent. When trying to just try out phrases using "#mention hello" or "mention hello" (where mention is our bot name), in the web chat or the bot emulator it properly triggers the Greeting intent. Yet, in the 1-on-1 chat in teams when we #mentioned the bot again this gave the StopVM intent again.
Is there any way to account for the #mention in our LUIS model? Or perhaps is there a way we could use REGEX to strip out the #mention before it is sent to our LUIS?
But then there is the other problem that responding to the bot to go through our form flows also sends #mention or mention to the form fields when we are not currently expecting this.
I guess the overall question is how do we account for the #mention in the user responses?
LUIS regex entities are not used to strip things; they are used to recognize entities.
Create a regex to recognize #mentions by creating a new entity of a regular expression type called AtMention or perhaps BotOrPerson as described in the article mentioned above, and then just include #mentions in your utterances. Your model will then recognize them for what they are.
The AtMention/BotOrPerson entities can either have no significance in your model or you can do something different if they are present - for example if the utterance #mentions someone other than the bot, it can trigger special behavior.
(#wajeed-msft - your suggestion won't work because LUIS sees the user's input before the bot does.)
I have developed a bot with the Microsoft Bot Framework (Builder v3.12.2.4, which is the latest version at this moment). I actually updated all libraries to the latest version, having AdaptiveCards as well, latest beta10.
So, I built the bot, deployed it, everything working great. But all of the sudden, all platforms give the response 'sorry, my bot code is having an issue'. So, at each input, the feedback is given (like hello, a card,...) but also this message.
I checked for double context.Wait() calls, which there are not.
I enabled Informational logging and put all kinds of logging, giving below results (no error to be seen in here, as my catch statements would log a row)
2017-12-04T16:45:40 PID[4812] Information Sentiment recognition ON: True
2017-12-04T16:45:41 PID[4812] Information Forwarded message to Luis Dialog: Hallo
2017-12-04T16:45:41 PID[4812] Information Detect Chat intent in Luis Dialog
What I do see, but that was already the case before is:
2017-12-04T16:45:46 PID[4812] Warning The Bot State API is being deprecated.
Please refer to https://aka.ms/yr235k for details on how to replace with your own storage.
However, this seems to be something internal on the bot framework...
The Bot service says 'I'm fine, no issues found'. So I am running out of ideas.
Anyone encountered this and has a clue. BTW: I have setup adaptive cards for 1 platform (telegram) and using built in herocard on another (skype, web chat) and all are giving this behavior
Additional information. I forgot to put 1 exception logging, being in the API Controller method itself.
This one says:
Operation returned an invalid status code 'Conflict'
However, I have no idea what it means. The default REST API explanations, found via https://learn.microsoft.com/en-us/rest/api/storageservices/common-rest-api-error-codes don't seem to make sense
The error message:
The Bot State API is being deprecated
Means that your chatbot needs to use your own storage for managing state. The URL in the message goes to the Manage custom state data with Azure Cosmos DB for .NET page, which explains why.
Last July, the Bot Framework team blogged about this: Saving State data with BotBuilder-Azure in .NET. If you read a couple of the other blog posts after that, you'll learn how to use other data stores, like SQL Server, for state management.
Really, you want to use your own state management because the amount of storage they provide is very small, improved performance, reduced latency, and greater control over state.
Setting up state should be a normal task for all of your chatbots.
According to this URL http://docs.botframework.com/connector/embed-chat-control/
We generate a token value which is used generate the iframe embed url.
I want to be able to access this token value from the corresponding bot.
If I can't access it directly, is there any way I can compute it inside the bot framework code?
If my understanding is right, you want to check whether your bot is working via embed chat through the bot itself rather than creating a new website and embedding it there.
I've embedded the widget in the default.htm file of my project and if the project is deployed on Azure, you can test its working.
Just code like this....
<div><iframe src="https://webchat.botframework.com/embed/MySimpleBotPlan?s=JXYDmEp8p7E.cwA.y6E.amTHXt9V7FN88DOagU7ST39iVBUKAEBcfQdaJgUbCt8">style="height: 502px; max-height: 502px;"></iframe></div>
Please find the sample code here.
The test might fail if you try the same code as I've stopped Azure services running, but you can try the sample code by deploying it on your Azure account.
This is another example which might be helpful too.
Please refer this documentation for the step by step tutorial.
Regards,
-Jyo
I am developing a Bot Framework application that integrates with Slack using Microsoft Bot technology. In the bot project, I was trying to get the user location when the user sends a message.
What I am trying to achieve is that, when a user types the message "Show me nearby hospitals", I want to get the users Geo coordinates and pass them to an API that will return a list of hospitals near that location. So any idea on how to get the user's current location in the Microsoft Bot project?
I tried using the Geo location class, however I am not able to add the class reference directly and when I add the external DLL for the Geo location class, Visual Studio throws some errors.
Is there any way to get the users current location in Bots?
The Bot Framework is getting updated every minute!!!
The Bing location control for Microsoft Bot Framework makes the process of collecting and validating the user’s desired location in a conversation easy and reliable.
The control is available for C# and Node.js and works consistently across all channels supported by Bot Framework.
Check the documentation here.
Click to view the code sample
This question is old but this is now a thing that exists to help with location hope it will help someone looking for this answer. https://github.com/Microsoft/BotBuilder-Location
Channels vary on whether they support location information. There is currently no way to get location information for users on Slack. Telegram, for instance, does. When location data is available it will returned in the Attachment data structure and in the channel's native format in the ChannelData field. Note that the user needs to opt into sending this data (to protect their privacy). The bot developer can send a message to the user requesting that they share their location data, but they cannot get it from the channel it w/o user action to share it.
This is currently not handled by the BotBuilder well. I've opened an issue to get this standardize across platforms. Regarding Slack, they don't have an option to send a location as an attachment as Telegram, Messenger and Kik do, so you might want to use Google Geocode API to derive coordinates from a string.