Botframework-sdk: Redis bot storage

Created on 2 Aug 2016  路  7Comments  路  Source: microsoft/botframework-sdk

Hi,

For the needs of a project, I'm currently building a redis storage adaptor for the node.js sdk. Would gladly publish it to the npm registry once stable :)

I already have a proof of concept working, but I'm ensure of something:

I need to store both user and conversation data. Right now I'm storing those into redis hashes with keys equal to 'u' + userId and 'c' + conversationId. I concatenate the ids with a prefix to avoid userId / conversationId key collision.
Question: Is it worth it, can I assume userId / conversationId will never collide ?
Another way to solve the issue, is to have each entity written to its own database.

Thanks !

All 7 comments

You may also need the channel ID and bot ID. Here is the key we use in C# for the bot data bags:

https://github.com/Microsoft/BotBuilder/blob/develop/CSharp/Library/Dialogs/BotData.cs#L60

@willportnoy Thanks, makes sense to me, closing this for now. I'll update my lib accordingly, make some unit tests, publish it to npm and leave a link in there.

@fdidron I need this as well, I'd be willing to pitch in since I will be building one regardless.

We have created a storage implementation for redis on nodejs: https://github.com/suttna/botbuilder-redis-storage

I created a storage implementation for MongoDB on nodejs:https://github.com/Manacola/msbotframework-mongo-middlelayer

@willportnoy what is your opinion? should the botbuilder users use redis, mongo etc? or simply stick with the defaults? I tried a mongo adapter and the problem is it fires 100s of queries. It will become a huge bottleneck when users starting chatting in good numbers. I understand redis is supposedly way better than using mongo for sessions but is the default option the best? Something tells me there is a reason you guys havent considered redis directly from the start

Was this page helpful?
0 / 5 - 0 ratings