Reputation: 1781
If I'm correct userData
, privateConversationData
and so on are stored in some remote database. How can I access this database (for instance to clear it during testing process)?
Upvotes: 0
Views: 844
Reputation: 14589
For basic implementation, the 'all user state database' is not accessible, you can only do actions by user (like /deleteprofile
).
The documentation adds a chapter called How do I version the bot data stored through the State API?
:
The State Service allows you to persist progress through the dialogs in a conversation, so that a user can return to a conversation with a bot days later without losing their position. But if you change your bot's code, the bot data property bags stored through the State API are not automatically cleared. You will have to decide whether the bot data should be cleared based on whether your newer code is compatible with older versions of your data. You can accomplish this in a few ways:
- During development of your bot, if you want to manually reset the conversation's dialog stack and state, you can use the /deleteprofile command (with the leading space so it's not interpreted by the channel) to clear out the state.
- During production usage of your bot, you can version your bot data so that if you bump the version, the associated data is cleared. This can be accomplished in Node using the exiting middleware or in C# using an IPostToBot implementation.
If the dialog stack cannot be deserialized correctly (due to serialization format changes or because the code has changed too much), the conversation state will be reset.
See also this topic on BotBuilder Github about storage. And this question also for security regarding state
You can use your own Azure storage for your bot thanks to BotBuilder-Azure
extension provided by Microsoft.
It is avaible on github here and it:
enable bot developers to integrate bots with specific Azure components.
Azure Table Storage: Allows bot developers to store bot state in their own Azure Storage accounts.
DocumentDB: Allows bot developers to store bot state in DocumentDB
So once you set this up, you may be able to get your data with javascript as it's your own Azure storage.
Upvotes: 1
Reputation: 2213
Since it isn't specified I'm going to assume you are working in C#.
If you are able to use the IDialogContext object your can use that to access these stores.
//Access private conversation data
context.PrivateConversationData
//Access user data
context.UserData
//Access conversation data
context.ConversationData
After this you have a few methods to work with. The most important are TryGetValue(..)
, SetValue(..)
and RemoveValue(..)
.
Upvotes: 1