Battle-tested middleware for botmaster http://botmasterai.com/).
- similar API to 'fulfill' middleware
- allows caching of responses
- manages merging
- stuff anything else you need in your enrichers in params
- callbacks, promises, and sync returns supported in controllers
- Scrapping websites for hours or telephone numbers to provide to bot
- Validating user input
The enricher spec is an object that describes an enricher
| Parameter | Description |
|---|---|
| controller | Function a controller that can return error last callback, a promise or sync. Called with (params, calback). Its result will be merged with the results from other controllers and the old context. |
| cache | Boolean whether or not to cache the result |
| ttl | Integer if caching how long the result should stay cached in milliseconds |
The following properties are available in params.
| Parameter | Description |
|---|---|
| context | the current context |
| update | in botmaster the update is provided |
| bot | in botmaster the bot is provided |
Run the given enrichers with context and update the given old context. Return using the callback.
Parameters
optionsobject options for the created middleware
Returns enrich a function that can enrich context
Used to enrich a context
Parameters
Factory function to generate incoming ware for enrich
Parameters
$0Object options
Returns Function botmaster middleware