Search code examples
node.jsibm-cloudibm-watsonwatson-conversation

how to add update multiple response of a dialog node in IBM watson assistant with Nodejs


I have a node application which is interacting with IBM watson assistant. I need to update the response output of a dialog node and I'm using the following watson api

  var params = {
  workspace_id: //,
  dialog_node: 'greeting',
  new_dialog_node: 'greeting',
  new_output: {
    text: 'Hello! What can I do for you?'
    //add more than one text
  }
};

assistant.updateDialogNode(params, function(err, response) {
  if (err) {
    console.error(err);
  } else {
    console.log(JSON.stringify(response, null, 2));
  }
  });

the API only accepts object type text:'Hello! What can I do for you?' this also overwrites the previous response

the error [ { message: 'output should be of type Object', path: '.output' } ]

How can I update the Dialog and add multiple responses at the same time or update the existing one? thanks in advance!


Solution

  • Have you tried the following format for new_output?

    { "text": { "values": [ "first response", "second response" ], "selection_policy": "sequential" }