# Dynamic menus
Overview
In Workbot command recipes that invoke dialogs, a select
field can be defined with dynamic menu options that become available at runtime.
A Workbot command recipe with dynamic menu options
Menu options generated at runtime
The dynamic menu options are generated by a secondary 'Dynamic menu recipe'. As its name suggests, this recipe handles 3 important things:
- Monitors for dynamic menu events from dynamic menus in dialogs,
- Generates menu options, and
- Returns the menu options to the primary command recipe.
# Configuring a Workbot parameter with dynamic menu options
In a Workbot command recipe,
- Create a parameter
- Under Dialog control type, choose Select.
- Under Menu options, choose Dynamic.
- Under dynamic menu recipe, enter the recipe ID of the dynamic menu recipe responsible for generating the menu options. At this point, you must have already created a dynamic menu recipe. To learn more about dynamic menu recipes, jump to Dynamic menu recipes.
- (Optional) If you want to send more context to the dynamic menu recipe, you can pass parameters to it using the Dynamic menu recipe params field. Learn more in the New dynamic menu event trigger documentation.
A Workbot command recipe with dynamic menu options
When a user types in a dynamic menu field in a dialog, an event is sent to the dynamic menu recipe.
Menu options generated at runtime
# Configuring a Workbot parameter with dynamic menu options in a Post dialog action
You can also configure a dynamic menu field in a Post dialog action. Under Dialog form fields, configure your JSON like the following:
[
{
"type": "select",
"name": "your_parameter",
"label": "Your parameter",
"optional": false,
"data_source": "external",
"dynamic_menu_recipe": "28748",
"dynamic_menu_recipe_params": "stagename: Closed Won",
"min_query_length": 3
}
]
Configuring a dynamic menu field using JSON
Field | Description |
---|---|
type |
Type of field for this parameter. Use select for drop-down menus (including dynamic menus).
|
name |
API name of the parameter, for example, stagename .
|
label | Display name of the parameter, for example, Stage name. |
optional | If true, user is able to skip this field and submit the dialog. |
data_source |
Required by Slack for fields with dynamic menus. Value must be external .
|
dynamic_menu_recipe | ID of the dynamic menu recipe that generates and returns the dynamic menu options back to this recipe. |
dynamic_menu_recipe params |
Pass context to the dynamic menu recipe using comma-separated parameters, for example, |
min_query_length | Number of characters that must be typed by the user before an event is sent to the dynamic menu recipe. |
# Dynamic menu recipes
Dynamic menu recipes handle 3 important things:
- Monitor for dynamic menu events from dynamic menus in dialogs,
- Generates menu options, and
- Returns the menu options to the primary command recipe.
A typical dynamic menu recipes consist:
New dynamic menu event trigger
An action that searches and retrieves records from an app (for example, Salesforce). The search query is typically refined by using the 'typeahead'
Value
datapill from the New dynamic menu event trigger output. Since a dynamic menu event occurs when a user types 3 characters into a dynamic menu field, the 'typeahead'Value
datapill contains the 3 (or more) characters typed by the user. Using typeahead to refine searchReturn menu options action
A typical dynamic menu recipe
# Setting up dynamic menu capabilities in Enterprise Workbots
If you are using an Enterprise bot, you will need to configure the Options Load URL of your bot in Slack first. This is the URL where Workato receives dynamic menu events for Workbot.
In your Slack app configuration page, go to:
Features > Interactive Components > Message Menus
In the Options Load URL, key in a URL in this format:
https://www.workato.com/slack_webhooks/data_source?coak_id=1234 (opens new window)
where '1234' is your bot's custom OAuth ID. This ID can be found in the URL of your bot's custom OAuth profile.
# Related topics
Last updated: 7/2/2021, 7:31:20 AM