Passing Variables to Watson Dialog

In many situations, it may be useful to transfer known information (for example, a username for a personalized greeting) to a new Watson Dialog conversation to avoid asking for redundant or unnecessary user questions. Looking at the API documentation, I see no way to do this. Is there a better way to pass variables into the Watson Dialog dialog?

+5
source share
2 answers

In the Dialog service, a variable is part of the profile that you create to store information that users provide during sessions.

The following code shows an example profile profile that saves a username.

<variables> <var_folder name="username"> <var name="username" type="TEXT" description="The user name."></var> </var_folder> </variables> 

In your script, you set this variable by calling:

PUT /v1/dialogs/{dialog_id}/profile

with:

 { "client_id": 4435, "name_values": [ { "name": "username", "value": "Bruce Wayne" } ] } 

Remember to replace {dialog_id} and {client_id} .


We have an API API that allows you to check the API: Dialog API .
You can also read about it in the tutorial .

+4
source

It should also be noted that if you leave client_id, then one will be allocated to you. You can then pass this to the start of the conversation to make sure the profile is up. I found this useful when I have welcome messages that I want to embed in profile variables, for example. "Hello"

-1
source

Source: https://habr.com/ru/post/1234233/


All Articles