使用Watson Workspace,我想谈谈我使用IBM Conversation构建的bot。将IBM对话连接到Watson Workspace?
为此,我尝试修改watsonwork演示中的代码:https://github.com/watsonwork/watsonwork-echo(此演示显示如何将应用程序连接到Watson Workspace,并回应每个写在那里的'Hello'。) 现在,呼应消息,我想将该消息提供给对话并将该答案写回Watson工作区。
我认为这应该由线32-44改变app.js喜欢的东西
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参考相当容易:https://www.ibm.com/watson/developercloud/conversation/api/v1/#send_message (当然在文件的顶部的身份验证) 。 但这似乎并不奏效;我无法连接到对话机器人。有没有人做过类似的事情或者可能知道我做错了什么?
谢谢!