node package manager
It’s your turn. Help us improve JavaScript. Take the 2017 JavaScript Ecosystem Survey »



NPM Version Build Status

This package contains multiple middlewares allowing to customize and optimize Botify SDK's behaviour. Including local storage caching, request dedupling, api result post processing.


npm install --save botify-sdk-middlewares

You’ll also need the Botify SDK (core).

npm install --save botify-sdk

UMD bundle

An UMD bundle is available in dist/botify-sdk-middlewares.min.js. It means you can use the lib with any module loader, including Browserify and RequireJS. It exposes the global variable BotifySDKMiddlewares.

<script src="/node_modules/botify-sdk-middlewares/dist/botify-sdk-middlewares.min.js"></script>


Use applyMiddleware function to apply middlewares you need.

import { applyMiddleware, apiErrorMiddleware, lscacheMiddleware } from 'botify-sdk-middlewares';
import baseSdk from 'botify-sdk';
const sdk = applyMiddleware(

<!> Becareful: order maters. (read middleware's documentation requirement section).


Note: examples are written with ES6 syntax but nothing prevents you to use this lib (and create middlewares) with plain old school JavaScript.


  • npm run lint: lint sources and tests using ESlint.
  • npm test: launch tests
  • npm run test:watch: watch files and execute the tests whenever sources or tests change.


The middleware pattern used in this package has been greatly inspired by Redux middlewares.