Versions Compared
Version | Old Version 6 | New Version 7 |
---|---|---|
Changes made by | ||
Saved on |
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Table of Contents |
---|
Introduction
Helium and the Helium DSL provides built-in functionality for USSD integration. The DSL provides an interface for these integrations through a USSD function annotation, and MezUssdMenu
and MezUssdMenuOption
built-in objects.
Functions that are annotated with @USSD
serve as integration endpoints that are available to be executed for inbound requests from USSD gateways. These functions then return an instance of MezUssdMenu
that describes the next menu structure that is to be presented to the end user during his USSD session.
Overview
The basis of integrating with a USSD gateway is through calls from the USSD gateway to Helium.
When a user initiates a USSD session on the mobile device an API call is made to Helium's API. The calls are then routed to a specific @USSD
annotated DSL function within an app. The app then responds with the menu structure that is to be presented to the end user and Helium translates this response as is required by the specific gateway.
@USSD
One of the following signatures is expected for USSD annotated functions:
Code Block |
---|
@USSD("description") MezUssdMenu processUssd(int menu, int selection) |
Code Block |
---|
@USSD("description")
MezUssdMenu processUssd(int menu, int selection, json gatewayArgs) |
The "description" values in the example above and below represents a unique string literal identifier for the specific USSD function. More than one USSD method can be included as long as the descriptions are unique. Further more the descriptions are used as path parameter values in Helium's internal API and can thus be used to route inbound calls to the correct DSL USSD functions.
The method parameters above represents the following:
menu:
An integer that indicates the menu from which the USSD request originated. For an initial call a value of 0 is sent.
selection:
An integer that indicates the menu option that was selected for the current request. For an initial call a value of 0 is sent.
gatewayArgs:
A json parameter that is populated with all additional query parameters sent by the gateway to Helium. At present the only gateway that is supported is Vodacom USSD gateway. Note that this parameter is optional. The following shows an example of values that are a value sent for this parameter using the Vodacom USSD gateway:
Code Block |
---|
{ "msisdn":"27763303624", "request":"*120*247253#", "provider":"Vodacom", "ussdSessionId":"2496158596" } |
The json attributes listed in the above example represent to the following and can be used in the DSL logic for more context or can be ignored.
Attribute | Description |
---|---|
msisdn | The msisdn / mobile number that initiated the USSD session and request. |
request | A field that describes the request made by the mobile end user. For requests where free text answers are provided, this field will contain the provided free text value. |
provider | Name of the USSD provider. For the Vodacom gateway it will always be "Vodacom". |
ussdSessionId | An integer value sent by the gateway that identifies the current USSD session. Note that at present Helium does not do any internal tracking of USSD sessions. |
MezUssdMenu and MezUssdMenuOption
The DSL provides the MezUssdMenu
and and MezUssdMenuOption
built built-in objects that are used to structure return values for any USSD annotated functions. The details of these objects are as follows:
Code Block |
---|
object MezUssdMenu {
// Integer representing the id of this menu
// This id is sent back to the DSL as the 'menu' argument for calls originating from this menu
// Helium does not do any validation or uniqueness of this value
int menuId;
// The header text / question for this menu
string headerText;
// Flag indicating whether this menu is to be used for a free text question
// By default (for both null and 'false' values) it is assumed that the menu is not a free text menu
bool isFreeText;
} |
Code Block |
---|
object MezUssdMenuOption {
// The text for this menu option
string text;
// The order for this menu option
// This value is sent back to the DSL as the 'selection' argument for calls that
// originated from user requests that selected this option
int order;
// The menu options that are available for this menu
// Menus that require free text input will not have any menu options
@ManyToOne
MezUssdMenu menu via menuOptions;
} |
Multiple Option Example
Free Text Example
Additional Considerations
Excerpt | ||
---|---|---|
| ||
@USSD | MezUssdMenu | MezUssdMenuOption |