Basics
DSL Quick Reference
DSL Quick Reference
This page provides a comprehensive reference for all USSD DSL blocks, properties, and syntax patterns.
Application Block
The root block defining your USSD application.
Code
Application Properties
| Property | Required | Type | Description |
|---|---|---|---|
shortcode | ✅ | string | USSD code users dial (e.g., *123#, *555*1#) |
version | ✅ | string | Semantic version for tracking changes |
start | ✅ | string | Name of the first menu to display |
options | ❌ | block | Global configuration (HTTP, secrets, navigation) |
env | ❌ | map | Environment variables accessible via {{env.*}} |
auth | ❌ | block | Global authentication for HTTP calls |
Options Block
Configure global application settings.
Code
Options Properties
| Property | Type | Description |
|---|---|---|
http_base_url | string | Base URL for relative HTTP action URLs |
secrets_engine | block | Tenant-scoped secrets provider configuration |
global_actions | block | Global Back/Home key configuration |
Secrets Engine Properties
| Property | Required | Description |
|---|---|---|
provider | ✅ | Provider type (tenant_vault, azure_keyvault) |
path | ✅ | Path template for secrets (supports {{org.id}}, {{app.name}}) |
Global Actions Properties
| Property | Type | Description |
|---|---|---|
back_key | string | Key that navigates back in history (e.g., "0") |
home_key | string | Key that returns to start menu (e.g., "99") |
Menu Block
User-facing screens that display text and capture input.
Code
Menu Properties
| Property | Required | Type | Description |
|---|---|---|---|
text | ✅ | string | Message displayed to the user |
terminal | ❌ | boolean | When true, ends session on display |
option | ❌ | block(s) | Navigation options (can have multiple) |
data_source | ❌ | block | Data-driven menu configuration |
A menu with no options and no data_source is automatically terminal (ends the session).
Option Properties
| Property | Required | Type | Description |
|---|---|---|---|
label | ✅ | string | Description shown to user |
goto | ✅ | string | Target menu or action name |
actions | ❌ | array | Action chain to execute before navigation |
error_target | ❌ | string | Menu to navigate on action chain error |
transactional | ❌ | boolean | Rollback on error (default: true) |
Wildcard Option
Use "*" as the selector to match any input not matched by specific options:
Code
The user's input is available via {{session.input}}.
Action Block (Legacy)
Standalone action blocks for backward compatibility.
Code
Action Properties
| Property | Required | Type | Description |
|---|---|---|---|
type | ✅ | string | Action type (see Action Types below) |
on_success | ❌ | string | Menu/block to navigate on success |
on_error | ❌ | string | Menu/block to navigate on error |
auth | ❌ | block/string | Per-action auth override ("none" to disable) |
Prefer inline action chains on menu options over standalone action blocks for new development.
Authentication Block
Configure authentication for HTTP calls.
Basic Authentication
Code
API Key Authentication
Code
OAuth2 Client Credentials
Code
Disable Authentication
Code
Data Source Block
Configure data-driven menus that fetch options from an API.
Code
Data Source Properties
| Property | Required | Default | Description |
|---|---|---|---|
type | ❌ | "http" | Data source type |
method | ❌ | "GET" | HTTP method |
url | ✅ | - | Endpoint URL |
response_array_path | ❌ | (root) | JSON path to array in response |
display_template | ✅ | - | Template for option labels |
selected_variable | ❌ | "selectedItem" | Session variable for selection |
on_select | ✅ | - | Target menu when item selected |
page_size | ❌ | 5 | Items per page |
filter | ❌ | - | Filter expression |
sort_by | ❌ | - | Field to sort by |
sort_order | ❌ | "asc" | Sort direction ("asc", "desc") |
limit | ❌ | - | Maximum items to fetch |
empty_message | ❌ | "No items available" | Empty list message |
empty_goto | ❌ | - | Auto-redirect on empty |
error_menu | ❌ | - | Error navigation target |
next_label | ❌ | "More" | Next page option label |
previous_label | ❌ | "Previous" | Previous page option label |
timeout_seconds | ❌ | 30 | Request timeout in seconds |
retry_count | ❌ | 2 | Retry attempts on failure |
retry_delay_ms | ❌ | 500 | Delay between retries (ms) |
Action Types
Summary Table
| Type | Aliases | Purpose | Key Fields |
|---|---|---|---|
noop | - | No operation | - |
set | - | Set variable value | target, value/source |
inc | increment | Increment number | target, by |
dec | decrement | Decrement number | target, by |
delete | remove | Remove variable | target |
env | environment | Get config value | key, target, fallback |
arithmetic | add, subtract, multiply, divide, modulo | Math operations | op, left, right, target |
conditional | if | Branching | lhs, op, rhs, true_target, false_target |
switch | - | Multi-case routing | source, cases, default_target, target |
string | concat, substring, upper, lower, trim, split, format | String operations | op, inputs, target |
validate | - | Input validation | source, pattern/min/max |
crypto | hash, encrypt, decrypt | Hash/encrypt | mode, input, target |
http | http_call, api_call | HTTP requests | url, method, response_map |
grpc | - | gRPC calls | client, method, request_fields |
send_sms | - | Send SMS message | recipient, message, sender_id, target |
send_otp | - | Send OTP | phone_number, purpose, expiry_minutes, sender_id, target |
See Actions Reference for complete details.
Comments
Code
Full Example
Code
Last modified on