# Dynamic menus

How dynamic menus work Overview

In Workbot command recipes that invoke dialogs, a select field can be defined with dynamic menu options that become available at runtime.

Dynamic menu A Workbot command recipe with dynamic menu options

Menu options at runtime 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:

  1. Monitors for dynamic menu events from dynamic menus in dialogs,
  2. Generates menu options, and
  3. Returns the menu options to the primary command recipe.

# Configuring a Workbot parameter with dynamic menu options

In a Workbot command recipe,

  1. Create a parameter
  2. Under Dialog control type, choose Select.
  3. Under Menu options, choose Dynamic.
  4. 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.
  5. (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.

Dynamic menu 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 at runtime 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 dynamic menu in a Post dialog action 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,
              stagename: Closed Won, closed: true
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:

  1. Monitor for dynamic menu events from dynamic menus in dialogs,
  2. Generates menu options, and
  3. Returns the menu options to the primary command recipe.

A typical dynamic menu recipes consist:

  1. New dynamic menu event trigger

  2. 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  to refine search Using typeahead to refine search

  3. Return menu options action

Typical dynamic menu recipe 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.

Custom OAuth ID


Last updated: 7/2/2021, 7:31:20 AM