Skip to content

a standardized way to make your bot context-aware. It exposes an API for enrichers which are procedures you can run to add variables to the context before sending to an NLU processor like Watson Conversation, LUIS or API.ai

License

Notifications You must be signed in to change notification settings

botmasterai/botmaster-enrich

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status

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
    • options.enrichers object enrichers to run on the new context
    • options.params object? merged with the standard params passed to enricher controller

Returns enrich a function that can enrich context

enrich

Used to enrich a context

Parameters

  • context Object context to enrich
  • callback Function error first callback, returns enriched context

EnrichIncomingWare

Factory function to generate incoming ware for enrich

Parameters

  • $0 Object options
    • $0.enrichers Object an object of enrichers
    • $0.sessionPath String? dot denoted path find the context in the update. defaults to 'context'
    • $0.params Object? optional additional params to pass to enrichers

Returns Function botmaster middleware

About

a standardized way to make your bot context-aware. It exposes an API for enrichers which are procedures you can run to add variables to the context before sending to an NLU processor like Watson Conversation, LUIS or API.ai

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published