Created
May 15, 2017 08:03
-
-
Save gittimos/9a4fcbe37d26687526136c2e8cfaa7ea to your computer and use it in GitHub Desktop.
Using the Watson API with the Node.js SDK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var watson = require('watson-developer-cloud'); | |
// username and password of the service | |
// see https://www.ibm.com/watson/developercloud/doc/common/getting-started-credentials.html | |
var conversation = watson.conversation({ | |
username: process.env.WATSON_USERNAME, | |
password: process.env.WATSON_PASSWORD, | |
version: 'v1', | |
version_date: '2017-04-21' | |
}); | |
var context = {} | |
conversation.message({ | |
workspace_id: process.env.WATSON_WORKSPACE_ID, | |
input: {'text': 'SOMETEXT', | |
context: context | |
}, function(err, response) { | |
if (err) | |
console.log('error:', err); | |
else | |
console.log(JSON.stringify(response, null, 2)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment