Menus & Nodes
Build the interactive screens subscribers step through, and take extensions off shared codes.
A menu is a named tree of screens. Each node is one screen with a prompt and a set of child options. Menus attach to a USSD code or an extension through the menu_id field. An extension is a sub-code under a shared code, e.g. *657*42# where 42 is your extension on the shared *657#.
Extensions
Extensions can be routed to a menu, a survey, or a custom callback URL, just like a dedicated code.
List extensions
curl -X GET "https://timisha-solutions-api.salamu.co.ke/api/v1/ussd/extensions" \
-H "Authorization: Bearer YOUR_API_TOKEN"Request an extension
UUID of the shared USSD code
Extension string (e.g. 42)
Networks to activate on
Quoted monthly price if known
curl -X POST "https://timisha-solutions-api.salamu.co.ke/api/v1/ussd/extensions" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"ussd_code_id": "code-uuid",
"extension": "42",
"networks": [
"safaricom"
]
}'Update an extension
menu | callback | survey
Webhook URL for callback mode
Survey UUID for survey mode
Menu UUID for menu mode
curl -X PUT "https://timisha-solutions-api.salamu.co.ke/api/v1/ussd/extensions/ext-uuid" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"mode": "menu",
"menu_id": "menu-uuid"
}'Delete an extension
curl -X DELETE "https://timisha-solutions-api.salamu.co.ke/api/v1/ussd/extensions/ext-uuid" \
-H "Authorization: Bearer YOUR_API_TOKEN"Menus
List menus
curl -X GET "https://timisha-solutions-api.salamu.co.ke/api/v1/ussd/menus" \
-H "Authorization: Bearer YOUR_API_TOKEN"Create a menu
Menu name (internal)
Text shown at the top of every menu screen
Message shown when a subscriber enters an invalid option
Internal description
curl -X POST "https://timisha-solutions-api.salamu.co.ke/api/v1/ussd/menus" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Main Menu",
"header_text": "Acme Services",
"invalid_input_text": "Invalid choice. Please enter a number from the menu."
}'Get, update, delete a menu
curl -X GET "https://timisha-solutions-api.salamu.co.ke/api/v1/ussd/menus/menu-uuid" \
-H "Authorization: Bearer YOUR_API_TOKEN"curl -X PUT "https://timisha-solutions-api.salamu.co.ke/api/v1/ussd/menus/menu-uuid" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Main Menu",
"header_text": "Acme Services (Updated)"
}'curl -X DELETE "https://timisha-solutions-api.salamu.co.ke/api/v1/ussd/menus/menu-uuid" \
-H "Authorization: Bearer YOUR_API_TOKEN"Nodes
Nodes form the tree structure. A node with no parent_id is the root, the first screen a subscriber sees. Each node has an option_number the subscriber types to reach it, and a type controlling what happens next.
Create a node
Number the subscriber types (e.g. 1, 2, 0 for back)
Display label in the parent menu list
menu | end | callback, what this node does
Text shown when this node is active (for end/callback types)
URL to POST to for callback-type nodes
Parent node UUID. Omit for the root node.
Display order within the parent
Create the root node (first screen):
curl -X POST "https://timisha-solutions-api.salamu.co.ke/api/v1/ussd/menus/menu-uuid/nodes" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"option_number": "0",
"label": "Main Menu",
"type": "menu",
"sort_order": 0
}'Create a child option under the root that hands off to your server:
curl -X POST "https://timisha-solutions-api.salamu.co.ke/api/v1/ussd/menus/menu-uuid/nodes" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"parent_id": "root-node-uuid",
"option_number": "1",
"label": "Check balance",
"type": "callback",
"callback_url": "https://yourserver.com/ussd/balance",
"sort_order": 1
}'Get, update, delete a node
Node operations are keyed by node UUID, not the parent menu.
curl -X GET "https://timisha-solutions-api.salamu.co.ke/api/v1/ussd/menus/nodes/node-uuid" \
-H "Authorization: Bearer YOUR_API_TOKEN"curl -X PUT "https://timisha-solutions-api.salamu.co.ke/api/v1/ussd/menus/nodes/node-uuid" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"label": "Check airtime balance",
"sort_order": 1
}'curl -X DELETE "https://timisha-solutions-api.salamu.co.ke/api/v1/ussd/menus/nodes/node-uuid" \
-H "Authorization: Bearer YOUR_API_TOKEN"Test before you ship