Response model
Define the information sent or retrieved from data requests in your NLX workspace
Last updated
Define the information sent or retrieved from data requests in your NLX workspace
Last updated
Response model allows you to specify and shape data to be retrieved from your data request for relay during a conversation, including a user's name registered in a profile, a list of available appointment times, and so on.
To access this feature, click the Response model tab of your data request:
Choose the response type for the model from the available dropdown:
String: A simple text value, such as a customer's name
Number: An integer, such as a customer's age
Boolean: A value consisting of true or false
Object: A well-defined structure of multiple values, such as name, age, occupation. These values can also be nested as any other response types
List: A list of values that can have other response types nested within. Use if wanting to provide the values to a user for selection when employing a User choice node in your intent flow. Either set your overall schema to list or set it to an object with a list type nesting the properties you want to provide as choices
An Object-type data request PersonProfile that has two values, name and address, may also be modeled as two separate String-type data requests, PersonName and PersonAddress. Deciding is a question of network performance and number of data requests to navigate. Since name and address may come from the same source and are linked to the same user, one Object-type seems appropriate. But if coming from different sources where the webhook has to send sequential requests, create two data requests to ensure info is fetched only when needed: name at the beginning of the conversation and address halfway through.
When selecting Object or List response schemas, a sub-items section will display to specify the multiple values you may want to reference from your array:
Expand Items section > Click + Add property
Expand new property section > Enter Field name matching the value's name
Choose the specific value's schema type using the dropdown
Repeat steps to add properties, as needed
Click Save
Save time by using the Auto-generate option.
Optional settings
Sensitive: Enable if you would like the values to be scrubbed from any resulting conversation logs
Description: Provide a statement describing the response model or intended function of the setup
One simple way of generating your response model is to use the model generation tool based on sample JSON objects or arrays:
Select <> Auto-generate
Enter/paste sample JSON response
Click Set response model
Click Save