Developer

Send USSD Menu State

Sends a menu to subscribers via Unstructured Supplementary Service Data (USSD), and expects menu-option responses. This is an abstract state type, which you can extend to develop dynamic menus.

Input Variables

Show Exit Menu Item – enter:
  • 1 for yes; this is the default.
  • 0 for no.

Output Variables

  • Variable for selected key – name of the session variable in which to store the selected option key.
  • Variable for selected value – name of the session variable in which to store the selected option value.

Follow-up State – OK

Typically used when the menu is created successfully, and the user sends a valid response.

Follow-up State – Fail

Used only if there is an internal error processing the dynamic menu.

Follow-up State – Dynamic

To process dynamic transitions, they must be implemented in the state’s code.

State Editor

In this example, if users send a valid response, another application is called to process the response. If an error occurs, control is passed to an application that terminates processing. The selected option key is stored in the session variable VAR_KEY, and the selected option value is stored in the session variable VAR_VALUE.


Send USSD Menu Application

Notes

This state enables you to create a dynamic menu, and present the menu to subscribers as a series of options with relevant responses. The menu items are:
  • Header text – enter in the Message input field, as the message header.
  • Options – provided programmatically in instances of this state type, by a state developer.
  • Paging Options – this state type automatically adds Next and Previous options to a menu list if there are more options than fit on a single page.
  • End Option – an option that you can add to end or exit the menu.

Usage

To implement a dynamic menu, create a subclass that extends this abstract class:
com.sybase365.mobiliser.brand.plugins.ussd.impl.AbstractDynamicUssdMenu
This abstract superclass creates and structures messages. Subclasses must override and implement abstract methods to provide the required functionality.
/* The state attribute list is already set */   
protected abstract Attribute[] getStateAttributeList();       

/*    
* Initialize the dynamic list, possibly based on subscriber information    
*/   
protected abstract SmappState init(SmappStateProcessingAction action)        
   throws MwizProcessingException, DBException, JAXBException, IOException,
          ServiceException, RequiredParameterMissingException;       

/*    
* Return the list of options in a format [[key,text],...]    
*/   
protected abstract List<KeyValuePair<String, String>> getMenuList()        
 throws NumberFormatException, DBException, RequiredParameterMissingException;       

/*    
* Allow the branching of processes based on selected key.    
* If you want to use the configured dynamic follow-up 
* transitions, override this method and return continueDyn(key); 
* otherwise, override this method and return null to follow the 
* OK transition when the user selects an option.    
*/   
protected abstract SmappState saveSessionVariables(SmappStateProcessingContext context, 
                              String key, String value)        
 throws MwizProcessingException, DBException, RequiredParameterMissingException;
...