Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

botkit-middleware-watson

Package Overview
Dependencies
Maintainers
4
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

botkit-middleware-watson - npm Package Compare versions

Comparing version 1.7.0 to 1.7.1

3

lib/middleware/index.js

@@ -111,2 +111,5 @@ /**

}
if (payload.context && payload.context.workspace_id && payload.context.workspace_id.length === 36) {
payload.workspace_id = payload.context.workspace_id;
}
return payload;

@@ -113,0 +116,0 @@ }).then(function(payload) {

2

package.json
{
"name": "botkit-middleware-watson",
"version": "1.7.0",
"version": "1.7.1",
"description": "A middleware for using Watson Conversation in a Botkit-powered bot.",

@@ -5,0 +5,0 @@ "main": "lib/middleware/index.js",

@@ -365,4 +365,28 @@ # Use IBM Watson's Conversation service to chat with your Botkit-powered Bot! [![Build Status](https://travis-ci.org/watson-developer-cloud/botkit-middleware.svg?branch=master)](https://travis-ci.org/watson-developer-cloud/botkit-middleware)

#### Dynamic workspace
If you need to make use of multiple workspaces in a single bot, workspace_id can be changed dynamically by setting workspace_id property in context.
Example of setting workspace_id to id provided as a property of hello message:
```js
function handleHelloEvent(bot, message) {
message.type = 'welcome';
var contextDelta = {};
if (message.workspaceId) {
contextDelta.workspace_id = message.workspaceId;
}
watsonMiddleware.sendToWatsonAsync(bot, message, contextDelta).catch(function (error) {
message.watsonError = error;
}).then(function () {
bot.reply(message, message.watsonData.output.text.join('\n'));
});
}
controller.on('hello', handleHelloEvent);
```
## License
This library is licensed under Apache 2.0. Full license text is available in [LICENSE](LICENSE).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc