Data-driven menus dynamically generate options from API data instead of hardcoding menu choices. The engine fetches a list from an HTTP endpoint and renders it as selectable options with automatic pagination.
Overview
A data-driven menu:
Fetches data from an HTTP endpoint on menu entry
Applies optional filter, sort, and limit transformations
Renders items as numbered menu options
Paginates long lists automatically
Stores the selected item in session for downstream use
Basic Example
DSL Definition
Code
application "MyStore" { name = "My Store App" short_code = "*123*5#" version = "1.0.0" start_block = "MainMenu" options { http_base_url = "https://api.mystore.com" } menu "MainMenu" { text = "Welcome to My Store" option "1" { label = "Browse Products" goto = "ProductList" } } # Data-driven menu - fetches products from API menu "ProductList" { text = "Available Products:" data_source { type = "http" method = "GET" url = "/products?category=electronics" response_array_path = "data.items" display_template = "{{name}} - ${{price}}" selected_variable = "selectedProduct" on_select = "ProductDetail" page_size = 5 empty_message = "No products available" error_menu = "LoadError" } } menu "ProductDetail" { text = "{{selectedProduct.name}}\nPrice: ${{selectedProduct.price}}" option "1" { label = "Add to Cart" goto = "AddToCart" } option "0" { label = "Back" goto = "ProductList" } }}
User Experience
When user navigates to ProductList:
Engine fetches GET https://api.mystore.com/products?category=electronics
API response: {"data": {"items": [{"name": "Phone", "price": 299}, ...]}}
Engine renders:
Code
Available Products:1. Phone - $2992. Tablet - $4993. Laptop - $8994. Watch - $1995. Earbuds - $799. More0. Back
User presses "2" → selectedProduct = {"name": "Tablet", "price": 499, ...} → navigates to ProductDetail.
Data Source Configuration
Required Fields
Field
Description
url
HTTP endpoint URL (absolute or relative to http_base_url)
display_template
Template for rendering each item label
on_select
Menu or action to navigate to when item is selected
Optional Fields
Field
Default
Description
type
"http"
Data source type (currently only HTTP supported)
method
"GET"
HTTP method
response_array_path
(root)
JSON path to extract array from response
selected_variable
"selectedItem"
Session variable name for selected item
page_size
5
Items per page
filter
(none)
Filter expression to include/exclude items
sort_by
(none)
Field name to sort by
sort_order
"asc"
Sort direction: "asc" or "desc"
limit
(none)
Maximum items to display
empty_message
"No items available"
Message when list is empty
empty_goto
(none)
Menu to auto-redirect when empty
error_menu
(none)
Menu to navigate on fetch error
timeout_seconds
30
Request timeout
retry_count
2
Retry attempts on failure
retry_delay_ms
500
Delay between retries in milliseconds
Filtering
Filter data before display using expressions:
Equality Filter
Code
data_source { url = "/products" display_template = "{{name}}" on_select = "ProductDetail" # Only show active items filter = "status == 'active'"}