botmaster-enrich
v0.0.4 chatbot bot chat pipeline context
Enrich NLU contexts
Battle-tested middleware for botmaster http://botmasterai.com/).
Introduction
- 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
Use cases
- Scrapping websites for hours or telephone numbers to provide to bot
- Validating user input
API
Enricher
Enricher Spec
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 |
Enricher controller params
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 |
Botmaster Ware
Enrich
Run the given enrichers with context and update the given old context. Return using the callback.
Parameters
options
object options for the created middleware
Returns enrich a function that can enrich context
enrich
Used to enrich a context
Parameters
EnrichIncomingWare
Factory function to generate incoming ware for enrich
Parameters
$0
Object options
Returns Function botmaster middleware
npm i [email protected]
Metadata
- MIT
- Whatever
- Jonathan R Wickens
- released 2/2/2017