0

I need save a data in Watson Conversation, for example:

-Watson say: Hello, tell me your name

-I say: My name is Isaac

-Watson say: Ok Isaac, good night!**

How can I save this value? Without telling Watson to say that when he recognizes Isaac's name. Just keep that data that is "name" and show it. And to be able to use that variable that I keep the name of Isaac in other nodes

Thank you very much!

Isaac Alejandro
  • 247
  • 1
  • 3
  • 8

1 Answers1

1

In this case you can use context variables or @sys-person (check Supported languages) within Watson Conversation to do that.

Context variables with regex:

And for get the name value, you need to use Regex to extract from the user input. And set it in all nodes that you want show the name of the user, for example.

{
  "context": {
    "name": "<? input.text.extract('yourRegextoExtractName')?>"
  },
  "output": {
    "text": {
      "values": [
        "Hi $name, how do you do?"
      ],
      "selection_policy": "sequential"
    }
  }
}

Note that I use the syntax to set the context variable: $name. So, just put in all nodes that you want show name the same syntax to set the name context variable.

@sys-person - System entities.

You can also active the @sys-person System entity, and use my example to save date below. Note that is BETA for now.

For use @sys-person, active on: Entities -> System entities -> @sys-person, see my image anothers actives system-entity: enter image description here

And your Conversation condition will be something like:

enter image description here

Result:

enter image description here

Sayuri Mizuguchi
  • 5,250
  • 3
  • 26
  • 53
  • Maybe add an example of sys-person. – Simon O'Doherty Mar 02 '18 at 13:20
  • Edited with @sys-person example Simon; Haha :) – Sayuri Mizuguchi Mar 02 '18 at 13:35
  • Along with what @SayuriMizuguchi has mentioned, for the question that was mentioned, it's better to use Slots feature where we can give sys-person entity. The Conversation service will automatically save the name mentioned to the context object, so that we don't need to manually mention it in the config object of the JSON response in conversation node. – Mrutyunjaya Jena Mar 02 '18 at 14:35