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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With