Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/suttna/botbuilder-redis-storage
Redis storage adapter for Microsoft BotBuilder
https://github.com/suttna/botbuilder-redis-storage
bot botbuilder redis
Last synced: about 4 hours ago
JSON representation
Redis storage adapter for Microsoft BotBuilder
- Host: GitHub
- URL: https://github.com/suttna/botbuilder-redis-storage
- Owner: suttna
- License: mit
- Created: 2017-07-14T15:55:02.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-02-01T18:26:57.000Z (12 months ago)
- Last Synced: 2024-04-14T23:12:36.185Z (9 months ago)
- Topics: bot, botbuilder, redis
- Language: TypeScript
- Homepage: https://suttna.com
- Size: 355 KB
- Stars: 14
- Watchers: 2
- Forks: 6
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
![Logo](logo.png)
# botbuilder-redis-storage [![npm version](https://badge.fury.io/js/botbuilder-redis-storage.svg)](https://badge.fury.io/js/botbuilder-redis-storage) [![CircleCI](https://circleci.com/gh/suttna/botbuilder-redis-storage.svg?style=svg)](https://circleci.com/gh/suttna/botbuilder-redis-storage) [![codecov](https://codecov.io/gh/suttna/botbuilder-redis-storage/branch/master/graph/badge.svg)](https://codecov.io/gh/suttna/botbuilder-redis-storage) [![Gitter](https://badges.gitter.im/suttna/botbuilder-redis-storage.svg)](https://gitter.im/suttna/botbuilder-redis-storage?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
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.
```javascript
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.```javascript
storage.setConversationTTLInSeconds(30 * 60) // 30 minutes
```## Test
To run the tests:
```
yarn install
yarn test
```## Contact
- Martín Ferández
- Santiago Doldán