Hello i have recently published my bot to azure and deployed it to messenger for testing purposes. The first part of the bot ask the user for name and age. How can i reset the whole conversation when the user type "reset"? Like delete all the data saved in memory storage. I am using C# and i save the user data to in-memory storage.
IStorage dataStore = new MemoryStorage();
var conversationState = new ConversationState(dataStore);
options.State.Add(conversationState);
First, I would echo what #JJ_Wailes has said about using the MemoryStorage provider in a production bot: just don't. 😊
That said, to answer your question directly, yes you can delete all state for a given BotState (e.g. ConversationState, UserState, etc) using the DeleteAsync API.
Hihi!
In-memory data storage is intended for testing only. This storage is volatile and temporary. The data is cleared each time the bot is restarted. There is no need to 'delete' it, it deletes itself the second you restart the bot. That being said, to 'reset' a bot in the FB messenger channel, when you're on the https://www.messenger.com page, navigate to the gear icon in the upper right:
There will be an option to 'delete' the conversation. Click this, then go to the right side, where there's a list of people. Search for your bot's name once more, and the bot conversation will be started over.
and voila! Reset:
Related
I've currently got a Bot running in Microsoft Teams, which has been built many years ago using the Microsoft Bot Framework v3 SDK. Now I will show an example of a location where I have saved some data after using the Bot, which I understand is stored in the "IBotDataBag".
So this method is the first method that is called when I enter a message to the Bot in Teams (as a result of the framework). It is injected with an object of type "IDialogContext" and this object contains other objects, one, which is of type "IBotData" and above in the image is "context.UserData". I use this to set some data, for example I had set it to store a value inside the key of "test_data", which I retrieve in the image above.
Now my question is, where in the Bot application is this data actually held? My application is deployed to Azure as an application service. It is installed locally in my Microsoft Teams after installing it from my Org's application catalogue. I want to know whether this data is held somewhere locally on my PC or in the cloud somewhere. Based on a test by uninstalling the Bot I thought if it was held in the cloud then the data set in the "IBotDataBag" would be removed but after installing the Bot after, the information was still present, which leads me to believe the Bot held onto the information locally on my machine. I have tried to find information to support this conclusion online but I have not spotted anything useful so far and I understand Microsoft are now very much pushing SDK v4 so was hoping someone on here can shed some light on the question for me please?
So after reviewing the architecture of the bot in its resource group in the Microsoft Azure portal, I found an entry of type "Storage Account", which is basically Azure Table Storage for the bot. In here there is a section for "Tables" and in here you will find an entry called "botdata". Inside of this table you will find several entries, which are identifiable by their partition key. After running doing some trial and error I found that removing the "msteams:user" entries would result in my bot not having any "UserData" inside of the context object. Based on several tests, I concluded that the data is held in table storage and that the bot framework handles the CRUD operations on this data.
The V3 SDK is being retired with final long-term support ending on December 31st, 2019. Accordingly, there will be no more development in this repo.We highly recommend that you start migrating your V3 bots to V4.
The v3 SDK currently supports two programing language. Bot builder SDK v3 includes samples for all supported languages:
.NET
JavaScript
Here some Code snippest-
private async Task MessageReceivedAsync(IDialogContext context,
IAwaitable result)
{
var activity = await result as Activity;
// An example of a string value saved directly to UserData
context.UserData.SetValue("test", "test");
// If we have not asked the user their name, ask it now
var askedName = context.UserData.GetValueOrDefault<bool>(AskedNameProperty);
if (!askedName)
{
await context.PostAsync($"v3: Hi. What is your name?");
// We've asked the user their name, so persist the information in UserData
context.UserData.SetValue(AskedNameProperty, true);
}
Reference Sample-https://github.com/microsoft/BotBuilder-Samples/blob/4d209edeaaaa72d29279057ff2c1ac3ce213694b/Migration/MigrationV3V4/CSharp/V3StateBot/V3StateBot/Dialogs/RootDialog.cs
Document-https://github.com/microsoft/botbuilder-v3
I want to make my chatbot dynamic. I have static knowledge base for my bot but my bot should process some dynamic functions.
Like,
on message of "today" Bot responds : 9th September 2019 , Saturday
10:47 UTC
On message of "my IP" Bot should respond : Your ip is 192.168.xxx.xx
(which is users local ip)
On message of "is my network printer working" bot should ping , check
and respond with a status :
: Your printer is down right now and maintenance is going on.
I have tried searching some blogs about functions in bot and i got one :
Blog
but it "open bot in azure function " is not there that is showed in blog
image of "open bot in azure function option"
If you want to your bot service could understand your input intention and then call the corresponding method to handle users' requests , using Azure LUIS service will be the proper way to implement to do it .
To be brief, LUIS service is used for getting natural language/text from user and reply them as an intent so that you can handle users' intents by different methods in your code.
The blog you provided just indicated a simple way to demo how to use LUIS with azure bot . Azure function is not a necessary service here.What's more, seems this way is not available anymore.
This demo which integrated with LUIS and QnA maker will be helpful for you to meet your requirement . You can refer to my previous post about how to run this demo .
If you have anything unclear , pls feel free to let me know : )
I am using the Microsoft Bot Framework for .NET to create a simple question/answer bot, as an ASP.NET MVC WebApi, written in C#, that will be used primarily on Slack channels with multiple users.
I have created a dialog which I initiate from my message controller as per the framework documentation:
await Conversation.SendAsync(activity, () => new QuestionDialog());
The lambda expression indicates to the Bot Framework which constructor to use for a dialog. QuestionDialog implements IDialog. After a dialog is initiated the dialog class is serialized and stored in the Bot Connector cloud, saving the current question and expected answer, then deserialized whenever a new message is received in the current conversation.
I want any user to be able to answer a random question presented by the Bot regardless of which user initiated the dialog but it seems that a new QuestionDialog is created for each user interacting with the bot so only the user initiating the question can answer it.
Is there any way of creating a dialog that is tied to the conversation/channel only rather than the combination of conversation/channel and user? Does it even make sense to attempt using a dialog in this way?
I guess the way I would implement this is to:
Store the state (the latest question) for each of the channels separately. For example, create a serializable class "QuestionState" which has at least the following properties: Service URL, conversation account ID and the question itself.
For each incoming activity (message), check the service URL and the conversation account ID of the sender and compare that against your list of states. If you find a match, evaluate the message (answer) in respect to the latest question. If there are no matches, this is a channel without previous state, so you need to create one and ask the first question.
Azure Table storage is a handy service to store the states in. You can, of course, use any service you like. Just keep in mind that in-memory state storage only works for testing.
In addition, you don't have necessarily have to use dialogs for this solution at all - you can do all you need to do in the MessagesController.
I recently deployed our first Azure webapp service and it was a pretty painless experience.
It was just a simple requestbin like api app to store id's fired by a webhook in to an azure data table and another end point to query if that ID is present. This is used to test the webhook in our deployment tests.
Works great, however at most I am expecting the may 60 table requests to hit the storage account a day in write and read pairs
in the last 24hr's I've received 10,23k requests (pretty consistently through the night) as well as queue and blob requests I don't have set up through the API Screenshot of azure data account requests
looking through the storage accounts audit logs I see almost exclusively list key operations with the 'Caller' column blank
audit log
does this mean this is an internal Azure process? Some are me but I would think that was me checking through the dash
The deploy tests themselves aren't live and the DataTable only includes the two initial test entities I inserted during testing so I can't really account for these requests. Rookie mistake I'm sure but any ideas?
Bonus: I use the below block to initialise my data table. it resides in the apiClient classes constructor method on a free tier instance. Does table.createIfNotExists() count as a data transaction and does being present in constructor hammer the call as azure moves across processes on the free tier
_storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
_tableClient = _storageAccount.CreateCloudTableClient();
table = _tableClient.GetTableReference("webhookreceipts");
// Create the table if it doesn't exist.
table.CreateIfNotExists();
thanks
Update:
I have left it running over night again and it appears to have followed the same pattern of cycling around 500 requests per hour through the night as before
Firstly, I would suggest you click Audit log "ListKeys" to see detailed info. Please focus on the properties 'EVENT TIMESTAMP' &'CALLER' to know when triggered and who did it. Secondly, please comment all the code related with Azure table to see the result. Thirdly, please create a new Azure account to see whether have the same issues. Everything works on my side. If this issue still exist, I would suggest you contact with Azure support to get a better help.
I use the .Net API for managing my organization's users within Google Apps. Within the directory API you can "RetrieveUser". This returns a User object that has a date property of "LastLoginTime".
Google used to separate out their Last Login Time for an account into three categories using the previous api.
last_login_time - the last time you directly logged into a google service using a UI
last_web_mail_time - the last time you logged into gmail.com webmail
last_pop_time - the last time you popped or imap'ed from their server. (indirect login)
In the new SDK, I don't see a specific "How we populate this" comment within their documentation. I'm wondering, and having trouble testing to figure out the rules myself:
How this is populated?
If it is not all encompassing usage that updates this date (usage meaning ANY interaction between the user and their account), how do I get other dates?
I use the last usage date to recycle idle users. Thus I need an accurate representation of what this date is. I've tested, and it appears popping from a google account is not represented within the SDK LastLoggedIn property, even though you need to log in to pop. Thus, any user that pops from the account and doesn't "Log In" could be deleted by accident.
API Reference
Appreciate any help.
These three (And more) properties still exist, just not attached to the "LastLoginTime". If you want to know if an account is truly idle, you'll need to use the Google.Apis.Admin.Reports.reports_v1 API. You can install via NuGet.
After you make your service object (Many stack answers can show you how to do this), usage is below:
UserUsageReportResource resource = _service.UserUsageReport;
UserUsageReportResource.GetRequest request = resource.Get("User#domain.ca", "yyyy-mm-dd");
UsageReports report = request.Execute();
All the interaction dates will need to be searched through, including LastLoginTime, and then take the latest. Each application has different dates all pertaining to when the last time the user did X action.
LastLoginTime appears to be simply the last time a user directly, or indirectly (via device), logged into the Gmail service. This does not include logging in for pop etc.