Retrieve Inputs in MenuText
Retrieving input
You can retrieve the results of previous inputs and other session values in a menu text using curly brackets around the name of the session variables. By design the egine mustache syntax to translate place holders to their actual values.
The following session values are constants present in every session. They cannot be set or modified
session.mobile
: The mobile number the user used to dial this sessionsession.network
: The network operator of the phone number usedsession.sessionId
: The sessionId of the current session
You can click on the info icon on top of the menu text box to popup the available session values :
Walkthrough
In the following walkthroughs we are going see an example of how to get user input in a menu text. We will add 3 menus. The first two will collect the user input and the last will retrieve the entered data including some additional session variables i.e mobile and network
1. First Menu
The first menu will ask for the age of the user
2. Second Menu
The second menu will ask for the gender with the following options
- Male
- Female
- Transgender
3. Retrieve User Input
The third menu will display inputs entered by the user including the phone number and mobile network
- We retrieve the age entered by the user with
session.inputs.ageMenu
.ageMenu
is the menu identifier we gave to the age menu screen. - We retrieve the value entered for gender with
session.inputs.gender
. This will give us value entered by the user, to retrieve the label we appendLabel
to becomegenderLabel
. Hencesession.inputs.genderLabel
we give us the label mapped to the input of the user.
NB: For all menus to get the label for any input appendLabel
to the menu identier - We retrieve the phone number of the dialer with
session.mobile
and the network operator withsession.network
We will enter the following text for the menu