Reputation: 270
In many situations, it may be helpful to pass known information (e.g. the user's name to present a personalized greeting) into a new Watson Dialog conversation so to avoid asking the user redundant or unnecessary questions. In looking at the API documentation, I don't see a way to do that. Is there a best practice method for passing variables into a Watson Dialog conversation?
Upvotes: 5
Views: 1312
Reputation: 1
It should also be noted that if you leave the client_id out then one is allocated for you. You can then pass this in to the start conversation call to make sure the that the profile is picked up. I found this useful where I have welcome messages which I want to imbed profile variables in to e.g. "Hello "
Upvotes: -1
Reputation: 23653
In the Dialog service a variable is part of a profile that you create to store information that users provide during conversations.
The following code shows an example of a profile variable that saves the user's name.
<variables>
<var_folder name="username">
<var name="username" type="TEXT" description="The user's name."></var>
</var_folder>
</variables>
In your scenario you will set this variable by calling:
PUT /v1/dialogs/{dialog_id}/profile
with:
{
"client_id": 4435,
"name_values": [
{
"name": "username",
"value": "Bruce Wayne"
}
]
}
Don't forget to replace {dialog_id}
and {client_id}
.
We have an API Explorer that let you try-out the APIs: Dialog API Explorer.
You can also read more about this in this tutorial.
Upvotes: 4