Isaac Alejandro
Isaac Alejandro

Reputation: 247

How can I save a data in Watson Conversation?

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!

Upvotes: 0

Views: 342

Answers (1)

Sayuri Mizuguchi
Sayuri Mizuguchi

Reputation: 5338

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

Upvotes: 1

Related Questions