Using Watson Workspace, I would like to talk to the bot I've built using IBM Conversation.
To do so, I tried to adapt the code from a watsonwork demo: https://github.com/watsonwork/watsonwork-echo (This demo shows how to connect an app to the Watson Workspace and echoes every 'Hello' that is written there.) Now, instead of echoing a message, I would like to feed the message into Conversation and write back that answer into the Watson Workspace.
I assume this should be quite easy by changing the app.js at lines 32-44 to something like
var context = {};
conversation.message({
  workspace_id: 'workspace-id',
  input: {'text': 'Turn on the lights'},
  context: context
  },  function(err, response) {
    if (err)
      console.log('error:', err);
   else
      console.log(JSON.stringify(response, null, 2));
});
API Reference: https://www.ibm.com/watson/developercloud/conversation/api/v1/#send_message (And of course the authentication at the top of the file). But this doesn't seem to work; I was not able to connect to the Conversation bot. Has anyone been doing something similar or might know what I'm doing wrong?
Thanks!!
via LoToast
 
No comments:
Post a Comment