Today, when working with Zendesk AI Agents and JSONata, it is possible to retrieve and display data from APIs (including large arrays), but there is no way to dynamically reference an array position based on user input during the conversation.
A very common use case is displaying a numbered list to the user, for example:
1 - Option A
2 - Option B
3 - Option C
...The user then replies with a number (e.g., “84”), and the expected behavior would be to map this input back to the corresponding item in the array and retrieve its attributes (such as an ID).
However, today it is not possible to perform something like:
var_array[user_input - 1].idThis creates a significant limitation when building scalable conversational flows that rely on dynamic data from APIs.
Why this matters
- Many APIs return large and dynamic datasets (100+ items, growing over time)
- Index-based selection is a simple and intuitive UX pattern for users
- There is currently no native way to map user input back to stored array data
- JSONata cannot be re-evaluated dynamically during the conversation using user input
As a result, developers are forced to:
- Use external middleware (e.g., APIs, automation tools) to resolve the selection
- Or redesign the experience (e.g., forcing buttons or embedding IDs), which is not always feasible
Limitations of current workarounds
- Creating individual variables for each item does not scale and breaks as data grows
- External processing adds latency, complexity, and dependency on additional infrastructure
- UX alternatives are sometimes restrictive or not suitable for all channels
Suggested improvement
Enable dynamic evaluation of variables using user input within the conversation context.
For example:
- Allow expressions like
var_array[user_input - 1] - Support runtime evaluation of JSONata (or similar) using variables collected during the dialogue
- Provide safe handling for invalid indexes (out-of-range, non-numeric input, etc.)
Expected benefits
- Fully dynamic and scalable conversational flows
- Reduced dependency on external systems
- Simpler implementations for common patterns (lists, selections, lookups)
- Better developer experience when working with APIs
- More natural and flexible user interactions
