Skip to content
Redis storage adapter for Microsoft BotBuilder
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
__tests__
src
.gitignore
.npmignore
CHANGELOG.md
CODE_OF_CONDUCT.md
Gemfile
Gemfile.lock
LICENSE
README.md
circle.yml
codecov.yml
jest.json
logo.png
package.json
renovate.json
tsconfig.json
tslint.json
yarn.lock

README.md

Logo

botbuilder-redis-storage npm version CircleCI codecov Gitter

Redis storage adapter for Microsoft BotBuilder. This class implements the IBotStorage interface.

Install

yarn add botbuilder-redis-storage redis

Usage

The storage depends on a redis client instance.

var redis = require('redis')
var RedisStorage = require('botbuilder-redis-storage').RedisStorage
var builder = require('botbuilder')

// Initialize redis client
var redisClient = redis.createClient(process.env.REDIS_URL, { prefix: 'bot-storage:' });

// Create new storage with redis client
var storage = new RedisStorage(redisClient)

var connector = new builder.ChatConnector()
var bot = new builder.UniversalBot(connector)

// Configure bot to use the RedisStorage
bot.set('storage', storage)

TTL for conversations

You can assign a life time for conversations. When enabling this feature, conversations that take longer than the give TTL will be deleted automatically. Be aware that future interactions with the bot after starting the conversation won't change the TTL of the conversation. Use this feature with caution.

storage.setConversationTTLInSeconds(30 * 60) // 30 minutes

Test

To run the tests:

yarn install
yarn test

Contact

You can’t perform that action at this time.