ibm-watsonchatbotwatson

How watson conversation should say good afternon based on time zone?


If the user logins to the website in morning, watson would say Good Morning!

If the user logins to the website in afternoon, watson would say Good afternoon!

If the user logins to the website in evening, watson would say Good Evening!

I've written like this

{
    "conditions": "now().before('12:00:00')",
    "output": {
    "text": {
    "values": [ "Good morning!" ]
   }
}

}

But after closing the json editor the code is changing to like this:

{
    "output": {
        "text": {
            "values": [
                "Good morning!"
            ]
        }
    }
}

Can anyone please say what the solution is? Please provide the entire code for ["good morning,good afternoon,good evening"]

`


Solution

  • You can't define conditions in the JSON editor. So it deletes any field that is not part of the schema.

    You can set the condition within the tooling UI at the IF statement section. Just paste in your condition part. As the functionality has recently changed, you will need to do the following.

    1. On the Welcome node, click the "Customise" Cog. Select "Allow multiple responses".

    enter image description here

    1. Set your conditions now at each response part.

    enter image description here

    If you are using the workspace API, then I recommend to export your workspace to see how a node block is correctly structured. Alternatively you can check the API spec.

    https://www.ibm.com/watson/developercloud/conversation/api/v1/#create_workspace