- Git clone this sample project
$ git clone https://github.com/kostickm/watsonSocketBot.git
- Change to your the newly cloned repo
$ cd watsonSocketBot/
- Create service in Bluemix named
conversation
- Click
Launch tool
. This will open the Conversation UI. - Import the
workspace-example.json
file located in your locally clonedwatsonSocketBot
directory - On your newly imported workspace click
View details
and save yourWorkspace ID
- Create service in Bluemix named
language-translator
- Create service in Bluemix named
tone-analyzer
- Replace
<workspace_id>
with your Watson Conversation Workspace ID in your localapp.js
file
/***********************************************************************
Watson Socket
************************************************************************/
socket.on('watson', function (data) {
console.log('Watson socket called');
const payload = {
workspace_id: process.env.WORKSPACE_ID || '<workspace_id>',
input: { text: data.message },
context: context,
};
You are now ready to deploy your application to Bluemix.
Note: You may also use the shorthand command bx
instead of bluemix
.
- Log into Bluemix CLI using your Bluemix credentials
$ bluemix api https://api.ng.bluemix.net
$ bluemix login
- From your local app directory deploy your app to Bluemix
$ bluemix app push <YOUR_APP_NAME>
Once your app has finished deploying, you are ready to start chatting.
-
From your Bluemix
Dashboard
, find your deployed app and click the assigned URL route. -
Enter a nickname, select a language, and hit
return
to enter the chatroom.
* Chat with Watson *
/watson <text>
Sample commands:
/watson Hey there!
/watson What can you do?
* Have Watson translate text *
/translate <language> <text_to_translate>
Sample commands:
/translate spanish My name is Megan
/translate french Hello
* Analyze the tone of all messages *
All messages are analyzed looking for Angry or Sad text.
- Update Watson Conversation Workspace with new Intents, Entities, and Dialog Flow.
- Add in an additional Watson service. Find examples here.