Data Query
The DataQuery step type is used to query data from the any of the custom data tables you have configured for the agent.
Options
| Or it can be the |
| The query that will be performed on the database. This will be an object matching the format described below in then “Query Format” section |
Output
| A list of all the objects then that were returned by the query. |
Properties
type | system |
needs conversation | [optional] |
uses content template | true |
uses options template | true |
customizable output schema | false |
Query Format
Queries to the system must be in the form of a JSON object matching the following schema
TableQuery
| If there are too many entries to return, this allows you to specify the start row when paging through multiple pages.
Default is 0. |
| This allows you to specify the last row to retrieve. or null to retrieve all rows. Default to null. |
| This is an object that maps field names to TableQueryFilter objects that describe the filtering to be done.
Default is an empty object, or no filters. |
| This is a list that contains
Default is to sort by |
TableSortModel
| The name of the field that is being sorted on. |
| The direction of the sort. Must be either |
TableFilterModel
| The type of filter to be applied. Must be one of |
| The type of operation to be performed on the data. Must be one of:
|
| This is the value to be used in the filter operation |
| When applying range queries, this is the second value in the query. E.g. you will get all data in-between the value of |
| When |
| When |
| When filter type is |
| When filter type is |
Examples Queries
Example 1 - Finding a record by email address
This will query the contacts table for all entries that match one of two specific email addresses.
{
"data_model_name": "contact",
"query": {
"startRow": 0,
"endRow": null,
"filterModel": {
"email_address": {
"filterType": "set",
"values": ["test@prosperalabs.ai", "cool@example.com"]
}
},
"sortModel": []
}
}Example 2 - 10 records between specific dates, sorted by name
{
"data_model_name": "contact",
"query": {
"startRow": 0,
"endRow": 10,
"filterModel": {
"created_at": {
"filterType": "date",
"type": "inRange",
"dateFrom": "2025-01-01",
"dateTo": "2025-01-28"
}
},
"sortModel": [
{
"colId": "name",
"sort": "asc"
}
]
}
}