Marc
Marc

Reputation: 1

Multi-Part answers for a node in IBM Watson Conversation service

I would like to be able to split up an response into multiple messages that are sent in a row - e.g. "Hi, i am a chatbot", "What can i do for you?" as 2 separate messages (that a client would render individually) Is there a way to do this without separate child-nodes? e.g.

{
  "output": {
   "text": {
   "append": true,
     "values": [
        "Hi, i am a chatbot",
        "What can i do for you"
      ],
      "selection_policy": "sequential"
}

Upvotes: 0

Views: 208

Answers (2)

Rohit
Rohit

Reputation: 187

You can simply use

  {
  "output": {
    "text": [
       "Hi, i am a chatbot",
        "What can i do for you"
    ],
    "selection_policy": "sequential"
  }

}

Remove Values from the json.

Upvotes: 1

data_henrik
data_henrik

Reputation: 17166

If you mean with "chained response" several messages that are printed below each other, you can simply use \n to denote a carriage return:

{
  "output": {
   "text": {
   "append": true,
     "values": [
        "Hi, I am a chatbot.\nWhat can I do for you?"
      ],
      "selection_policy": "sequential"
}

This would render to:

Hi, I am a chatbot.
What can I do for you?

I have a couple such reponses in this workspace. It is part of this tutorial for building a database-backed Slackbot. In that example, several of those output lines are computed dynamically and would, e.g., produce a formatted ASCII table.

Upvotes: 0

Related Questions