Lisanne
Lisanne

Reputation: 1

Connect IBM Conversation to Watson Workspace?

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!!

Upvotes: 0

Views: 586

Answers (1)

Sayuri Mizuguchi
Sayuri Mizuguchi

Reputation: 5330

I'm not sure, but, for some explanation I need the error when you try use your workspace with this repository. But, In this case you need to set your Service Credentials inside username and password variables, and not only the Workspace_id, because every Watson service created inside your IBM Bluemix have Services Credentials, but you can also see if you click inside the service this option.

But, I really recommend the official example from IBM developers: conversation-simple In this example you can easy set your credentials and use the project to test your conversation created (with the workspace_id), is a complete project. And you can follow the same steps to built your app. I did.

Upvotes: 3

Related Questions