Removed unused request dependency
Updated various dependencies.
Updated API version to latest: 20200513.
Browse the latest HTTP API documentation here.
The most important change is the removal of .converse() and .runActions(). Follow the migration tutorial here, or read more here.
converseandrunActionsare removed- updated and added new examples that leverage the /message API
- updated wit-ai-basic-app-for-tests.zip for testing
converseandrunActionsare deprecatedinteractivenow callsmessage
- support actions that do not return promises
- support the case where an action does not return a Promise
- update uuid to version 3.0.0
- Support older versions of node
- 'Use strict' on interactive.js
- Check for bot's message in messenger example
- Support for different JS environments
conversenow takesresetas an optional parameter
interactiveis no longer a function on theWitclient. Instead, you require it from the library:require('node-wit').interactiverunActionsnow resets the last turn on new messages and errors.
After a lot of internal dogfooding and bot building, we decided to change the API in a backwards-incompatible way. The changes are described below and aim to simplify user code and accommodate upcoming features.
We moved to a Promise-based API, instead of callbacks. This makes the code simpler and the error-handling more straight-forward. It's also inline with where JS is going with standards like fetch() and async/await that are based on Promises.
See ./examples to see how to use the new API.
sayrenamed tosendto reflect that it deals with more than just text- Removed built-in actions
mergeanderror - Actions signature simplified with
requestandresponsearguments - Actions need to return promises and do not receive the
cbparameter anymore - INFO level replaces LOG level
- configuration is now done when instantiating the
Witobject, instead of using env vars
- allows for overriding API version, by setting
WIT_API_VERSION
- adding API versioning (defaults to
20160516) - warns instead of throwing when validating actions
- fixing null values when cloning context
- callbacks are not called asynchronously by default, choice is left to the developer (use process.nextTick in your callback to emulate the previous behavior)
- using
node-fetchinstead ofrequests - the
message()API takes now an optional context as second parameter
- fixing context not updated in interactive mode
- fixing array values in context
- create readline interface only in interactive mode
Unifying action parameters.
- the
sayaction now takes 4 parameters:sessionId,context,message,cb - the
erroraction now takes 3 parameters:sessionId,context,error
Updating action parameters.
- the
mergeaction now takes 5 parameters:sessionId,context,entities,message,cb - the
erroraction now takes the context as second parameter - custom actions now take 3 parameters:
sessionId,context,cb
Bot Engine integration
- the library now provides a Wit object
captureTextIntenthas been moved toWit.messagewith no token- audio not supported