Request Programable Menu
Element Name: Request Programable Menu
Category: Programming
Description: Advanced extension module that allows invoking a menu entity. Values are obtained from a JSON object that has the following structure: {"val 1": "value description 1", "val 2": "value description 2"}
Functionality: This extension module can be used for the usage and overwriting of channel settings to present the menu. For example, adding an option to the menu based on a parameter queried from a client service.
For its configuration, the following parameters must be taken into account:
Request Programable Menu Configuration (Required)
Name: Unique descriptor for configuration box identification in the flow.
Configuration required to set the entity value (Required)
[Entity name obtained from an expression]: String expression where you should input the menu entity containing the question and menu options. JavaScript statements can also be written. For more information, refer to (media\entity.md).
[A string expression representing the JSON object containing the menu value]: String expression where values to be evaluated are entered, following this structure: {"val 1": "value description 1", "val 2": "value description 2"}.
[Maximum failed attempts obtained from an expression]: Integer expression where you should input the number of failed attempts allowed when executing.
[Invalid value message obtained from an expression]: String expression where you should input a message to be displayed when entering an invalid value. This message must be placed within single quotes.
[If the maximum failed attempts are reached, the action flow will be interrupted, and the error description will be passed to the selected intention named 'Request_Programable_Menu_Error'.] Dropdown box identifying the intention that will be activated in case of an error.
Menu Presentation on WhatsApp (Optional)
[Overwrite channel settings to present the menu]: Select 'Yes' to confirm that you want to overwrite the defined channel configuration or select 'No' to maintain the current configuration.
[Present Menu as Text (Text), Button, or List (List)]: Dropdown list with options to present the menu; these can be text type with the Text option, button type with the Button option, or a list with the List option.
[Language to present default elements of the interactive menu]: Dropdown list with languages configured in the Lynn application.
Configuration required for Enriched Menu (Optional)
[Header type]: Dropdown list with header options for the menu to be displayed; this can be as text, video, image, document, or none of the above.
[Expression to get the Footer code]: Optional string expression where you can input a footer.
If the user selects the text, video, image, or document option, the corresponding tab is displayed for configuring the Header:
Text Header-related Configuration (Optional)
-
Text Option:
[Expression to get the text Header code]: String expression where you should input the expression you want to evaluate.
-
Video Option:
[Expression to get the Video Header URL]: String expression where you should input the URL associated with the video you want to incorporate.
[Expression to get the Video Header Content Type]: String expression where you should input the content type related to the video.
[Expression to get the Video Header File Name]: String expression where you should input the file name of the video.
-
Image Option:
[Expression to get the Image Header URL]: String expression where you should input the URL associated with the image you want to incorporate.
-
Document Option:
[Expression to get the Document Header URL]: String expression where you should input the URL associated with the document you want to incorporate.
[Expression to get the Document Header Content Type]: String expression where you should input the content type related to the document.
[Expression to get the Document Header File Name]: String expression where you should input the file name of the document.
Request Programable Menu Implementation Example
There's a need to change the menu language based on information retrieved from a service so that foreigners can view their information in another language.
-- Requirements:
List-type entity: PruebaProgMenu ß Please select an option:
1 Metropolitan Region
2 Regions
-- Input:
[Entity name obtained from an expression]: 'PruebaProgMenu'
[A string expression representing the JSON object containing the menu value]: '{"Value":"E", "Description":"US Nationality"}'
[If the maximum failed attempts are reached, the action flow will be interrupted, and the error description will be passed to the selected intention named 'Request_Programable_Menu_Error']: Error_Handler
[Overwrite channel settings to present the menu]: 'Yes'
[Present Menu as Text (Text), Button (Button), or List (List)]: List
[Language to present default elements of the interactive menu]: en
-- Result:
Please select an option:
1 Metropolitan Region
2 Regions