You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+45-21Lines changed: 45 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
-
# Use IBM Watson's Conversation service to chat with your Botkit-powered Bot! [](https://travis-ci.org/watson-developer-cloud/botkit-middleware)
1
+
# Use IBM Watson's Assistant service to chat with your Botkit-powered Bot! [](https://travis-ci.org/watson-developer-cloud/botkit-middleware)
2
2
3
-
This middleware plugin for [Botkit](http://howdy.ai/botkit) allows developers to easily integrate a [Watson Conversation](https://www.ibm.com/watson/developercloud/conversation.html) workspace with multiple social channels like Slack, Facebook, and Twilio. Customers can have simultaneous, independent conversations with a single workspace through different channels.
3
+
This middleware plugin for [Botkit](http://howdy.ai/botkit) allows developers to easily integrate a [Watson Assistant](https://www.ibm.com/watson/services/conversation/) workspace with multiple social channels like Slack, Facebook, and Twilio. Customers can have simultaneous, independent conversations with a single workspace through different channels.
4
4
5
5
## Middleware Overview
6
6
@@ -18,7 +18,7 @@ This middleware plugin for [Botkit](http://howdy.ai/botkit) allows developers to
18
18
*`hear`: used for [intent matching](#intent-matching).
19
19
*`updateContext`: used in [implementing app actions](#implementing-app-actions) (sendToWatson does it better now).
20
20
*`readContext`: used in [implementing event handlers](#implementing-event-handlers).
21
-
*`before`: [pre-process](#before-and-after) requests before sending to Watson Conversation (Conversation).
21
+
*`before`: [pre-process](#before-and-after) requests before sending to Watson Assistant (Conversation).
22
22
*`after`: [post-process](#before-and-after) responses before forwarding them to Botkit.
23
23
24
24
@@ -28,18 +28,26 @@ This middleware plugin for [Botkit](http://howdy.ai/botkit) allows developers to
28
28
$ npm install botkit-middleware-watson --save
29
29
```
30
30
31
-
## Usage
31
+
## Prerequisites
32
32
33
-
### Acquire Watson Conversation credentials
33
+
1. Sign up for an [IBM Cloud account](https://console.bluemix.net/registration/).
34
+
1. Download the [IBM Cloud CLI](https://console.bluemix.net/docs/cli/index.html#overview).
35
+
1. Create an instance of the Watson Assistant service and get your credentials:
36
+
- Go to the [Watson Assistant](https://console.bluemix.net/catalog/services/conversation) page in the IBM Cloud Catalog.
37
+
- Log in to your IBM Cloud account.
38
+
- Click **Create**.
39
+
- Click **Show** to view the service credentials.
40
+
- Copy the `apikey` value, or copy the `username` and `password` values if your service instance doesn't provide an `apikey`.
41
+
- Copy the `url` value.
34
42
35
-
The middleware needs you to provide the `username`, `password`, and `workspace_id` of your Watson Conversation chat bot. If you have an existing Conversation service instance, follow [these steps](https://github.com/watson-developer-cloud/conversation-simple/blob/master/README.md#configuring-the-application-environmnet) to get your credentials.
43
+
1. Create a workspace using the Watson Assistant service and copy the`workspace_id`.
36
44
37
-
If you do not have a Conversation service instance, follow [these steps](https://github.com/watson-developer-cloud/conversation-simple/blob/master/README.md#before-you-begin) to get started.
38
45
39
46
### Acquire channel credentials
40
-
This document shows code snippets for using a Slack bot with the middleware. (If you want examples for the other channels, see the [examples/multi-bot](/examples/multi-bot) folder. The multi-bot example app shows how to connect to Slack, Facebook, and Twilio IPM bots running on a single Express server.)
47
+
This document shows code snippets for using a Slack bot with the middleware. (If you want examples for the other channels, see the [examples/multi-bot](/examples/multi-bot) folder.
48
+
The multi-bot example app shows how to connect to Slack, Facebook, and Twilio IPM bots running on a single Express server.)
41
49
42
-
You need a _Slack token_ for your Slack bot to talk to Conversation.
50
+
You need a _Slack token_ for your Slack bot to talk to Watson Assistant.
43
51
44
52
If you have an existing Slack bot, then copy the Slack token from your Slack settings page.
45
53
@@ -61,13 +69,29 @@ var slackBot = slackController.spawn({
61
69
});
62
70
```
63
71
64
-
Create the middleware object which you'll use to connect to the Conversation service:
72
+
Create the middleware object which you'll use to connect to the Watson Assistant service.
73
+
74
+
If your credentials are `username` and `password` use:
75
+
76
+
```js
77
+
var watsonMiddleware =require('botkit-middleware-watson')({
78
+
username:YOUR_ASSISTANT_USERNAME,
79
+
password:YOUR_ASSISTANT_PASSWORD,
80
+
url:YOUR_ASSISTANT_URL,
81
+
workspace_id:YOUR_WORKSPACE_ID,
82
+
version:'2018-07-10',
83
+
minimum_confidence:0.50, // (Optional) Default is 0.75
84
+
});
85
+
```
86
+
87
+
If your credentials is `apikey` use:
88
+
65
89
```js
66
90
var watsonMiddleware =require('botkit-middleware-watson')({
67
-
username:YOUR_CONVERSATION_USERNAME,
68
-
password:YOUR_CONVERSATION_PASSWORD,
91
+
iam_apikey:YOUR_API_KEY,
92
+
url:YOUR_ASSISTANT_URL,
69
93
workspace_id:YOUR_WORKSPACE_ID,
70
-
version_date:'2017-05-26',
94
+
version:'2018-07-10',
71
95
minimum_confidence:0.50, // (Optional) Default is 0.75
72
96
});
73
97
```
@@ -98,7 +122,7 @@ Then you're all set!
98
122
### Message filtering
99
123
100
124
When middleware is registered, the receive function is triggered on _every_ message.
101
-
If you would like to make your bot to only respond to _direct messages_ using Conversation, you can achieve this in 2 ways:
125
+
If you would like to make your bot to only respond to _direct messages_ using Assistant, you can achieve this in 2 ways:
102
126
103
127
#### Using interpret function instead of registering middleware
104
128
@@ -161,7 +185,7 @@ Note: if you want your own `hear()` function to implement pattern matching like
161
185
162
186
### Implementing app actions
163
187
164
-
Conversation side of app action is documented in [Developer Cloud](https://www.ibm.com/watson/developercloud/doc/conversation/develop-app.html#implementing-app-actions)
188
+
Watson Assistant side of app action is documented in [Developer Cloud](https://console.bluemix.net/docs/services/conversation/develop-app.html#building-a-client-application)
The _before_ and _after_ callbacks can be used to perform some tasks _before_ and _after_Conversation is called. One may use it to modify the request/response payloads, execute business logic like accessing a database or making calls to external services.
401
+
The _before_ and _after_ callbacks can be used to perform some tasks _before_ and _after_Assistant is called. One may use it to modify the request/response payloads, execute business logic like accessing a database or making calls to external services.
Copy file name to clipboardExpand all lines: examples/multi-bot/README.md
+39-4Lines changed: 39 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,10 +10,45 @@ This document describes how to set up a sample Express app which talks to Slack,
10
10
11
11
## Getting credentials
12
12
13
-
### Watson Conversation
14
-
Follow the steps outlined in [this document](https://github.com/watson-developer-cloud/conversation-simple/blob/master/README.md#configuring-the-app-environment) and paste your Conversation bot's credentials in the sample `.env` file in the project directory.
13
+
### Watson Assistant
14
+
15
+
1. Sign up for an [IBM Cloud account](https://console.bluemix.net/registration/).
16
+
1. Download the [IBM Cloud CLI](https://console.bluemix.net/docs/cli/index.html#overview).
17
+
1. Create an instance of the Watson Assistant service and get your credentials:
18
+
- Go to the [Watson Assistant](https://console.bluemix.net/catalog/services/conversation) page in the IBM Cloud Catalog.
19
+
- Log in to your IBM Cloud account.
20
+
- Click **Create**.
21
+
- Click **Show** to view the service credentials.
22
+
- Copy the `apikey` value, or copy the `username` and `password` values if your service instance doesn't provide an `apikey`.
23
+
- Copy the `url` value.
24
+
25
+
1. Create a workspace using the Watson Assistant service and copy the `workspace_id`.
26
+
27
+
1. Open the *.env* file and add the service credentials that you obtained in the previous step.
28
+
29
+
Example *.env* file that configures the `apikey` and `url` for a Watson Assistant service instance hosted in the US East region:
- If your service instance uses `username` and `password` credentials, add the `ASSISTANT_USERNAME` and `ASSISTANT_PASSWORD` variables to the *.env* file.
37
+
38
+
Example *.env* file that configures the `username`, `password`, and `url` for a Watson Assistant service instance hosted in the US South region:
1. Add the `WORKSPACE_ID` to the previous properties
47
+
48
+
```
49
+
WORKSPACE_ID=522be-7b41-ab44-dec3-g1eab2ha73c6
50
+
```
15
51
16
-
If you don't have a Conversation service instance, follow [these steps](https://github.com/watson-developer-cloud/conversation-simple/blob/master/README.md#before-you-begin) to get started.
17
52
18
53
### Slack
19
54
Follow the Getting Started section of this [document](https://github.com/howdyai/botkit/blob/master/docs/readme-slack.md) from Botkit.
When you're ready to test your bot, go to your Facebook homepage and find the page you created. Click on _Message_ to start chatting with your Watson Conversation bot!
81
+
When you're ready to test your bot, go to your Facebook homepage and find the page you created. Click on _Message_ to start chatting with your Watson Assistant bot!
47
82
48
83
### Twilio IPM
49
84
Follow the Getting Started section of this [document](https://github.com/howdyai/botkit/blob/master/docs/readme-twilioipm.md) from Botkit.
0 commit comments