Retrieve Inputs in MenuText

March 11, 2023

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.

Retrieve Inputs

The following session values are constants present in every session. They cannot be set or modified

  1. session.mobile : The mobile number the user used to dial this session
  2. session.network : The network operator of the phone number used
  3. session.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 :info icon

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

Step 3 screenshot

2. Second Menu

The second menu will ask for the gender with the following options

  1. Male
  2. Female
  3. Transgender Step 7 screenshot

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 append Label to become genderLabel . Hence session.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 append Label to the menu identier

  • We retrieve the phone number of the dialer with session.mobile and the network operator with session.network

We will enter the following text for the menu

Step 3 screenshot

4. Deploy the app for testing

Step 4 screenshot

5. Run the emulator

Step 5 screenshot

6. Click to dial

Step 6 screenshot

7. Enter a value for age

Step 7 screenshot

8. Select an option for gender

Step 8 screenshot

9. Output of replaced values

In the following output the place holders have been replaced with the actual values of the input entered by the user.

Step 9 screenshot