# Wait for user action in messages
Only specific Workbot actions and modals support the Wait for user action feature. These include:
The Section with button (new version) message block and Button (new version) option in Actions message block support the Wait for user action feature. This enables you to specify multiple steps of Workbot-user interaction in one recipe, which streamlines the logic, reduces the number of recipes, and avoids unnecessary and redundant bot commands. We recommend to always handle user action in the same recipe.
This guide explains how to configure the Wait for user action feature in Post command reply and Post message workbot actions.
# How to configure wait for user action
Select Section with button (new version) from the Type dropdown.
Configure the following fields:
Display text. Supports markdown.
Action to take on button-click
Select the Action you plan to happen when a user clicks the button. The Action you select here determines which additional fields you must configure. See Step 3 for details. Available actions include:
Use this option when the conversation flow continues after the user presses the button. Typically, this button can only be pressed once. For example, you can present Approve and Reject buttons to the user and configure Workbot to perform other actions after the user provides a response.
When you select Continue recipe, additional datapills (Selected button and Selected Block ID) are available in recipe data for use in subsequent steps.
CONTINUE RECIPE BUTTON BEHAVIOR
When a user clicks the Continue recipe button, Workbot deletes the current message to avoid the user clicking on the same button multiple times. If you plan to keep some information in front of the user after the button is clicked, consider splitting the message into two pieces. For example, you can have one message with the information that must remain and one message with the Continue recipe buttons.
Run bot command
Use this option when the button starts a separate flow outside of the main conversation. For example, you can present a Refresh data button to the user that loads the data from an external service and updates the message. Typically, users can press this type of button multiple times.
Open a URL after the user performs an action.
Select a button action
Button display text.
Reference this ID in downstream bot recipes to update block contents. If you leave this field blank, Slack randomly generates a value. 255 characters maximum.
Determine the style of your button. Choose from the following options:
Select from list
Select from a list of predefined options. These include:
The button style for default states.
The button style for primary actions and states.
The button style for danger states.
Enter a custom value
Workbot Block Kit custom values. Available values include default, primary, and danger.
Configure additional fields depending on the Action you selected in Action to take on button-click.
The following is the list of button actions and their required fields.
Run bot command
Workbot runs this command when a Slack user selects this option from the dropdown.
Select a command from a list of commands you pre-specify.
Enter a custom
Enter a custom value for the command.
Command input values
Pass values for the command input. For example, Name: John Smith Age: 42.
- The URL that opens when the user clicks the button.
# How to use Wait for user action in downstream steps
If you chose the Continue recipe button action in Step 2 of the preceding section, you must determine what happens next.
This section describes how to build recipe logic around wait for user action in downstream steps.
Click the + (plus) button.
Select IF condition.
Select an app (Workbot for Slack) and action (Post message or Post command reply).
Configure the IF condition by mapping in the button action you determined in the preceding recipe step.
Map in the Selected button datapill from the output of recipe Step 2. The Selected button is the button you chose when determining the Action to take on button-click.
Choose a condition, for example, equals.
Determine a value. Determine a value that corresponds to the button title of the selected button(s). In our example, we have chosen Continue recipe, which is also the button title from recipe Step 2.
Map in the Selected button datapill
Determine what happens next.
In our example, IF Selected button datapill from Step 2 contains Continue recipe, Workato adds a row to a sheet in Google Sheets.
IF else, Workato performs other actions.
In our example, we have another IF condition. You must configure the IF condition to handle the expiry date set for the user action.
Map in the Expired datapill
Map in the Expired datapill from the output of recipe Step 2.
Choose a condition. Because the Expired datapill has a boolean (true/false) value, we have chosen is true.
Configure the following optional field:
- Continue recipe if user does not click the button within
- After this time interval, no one can click the button; the recipe stops waiting, the value of the Expired datapill is set to TRUE, and the recipe automatically goes to the next step.
- Default value:
- 43200 minutes (30 days). You can enter custom values in minutes.
Determine what happens next.
In our example, IF Expired is true we have configured Workbot to send a message stating the action expired.
IF else, Workbot sends a message.
The following datapills are available when Action to take on button-click is set to Continue recipe and enable you to build downstream recipe logic.
Selected button: This datapill corresponds to the value of the Section text field (selected button name).
Selected Block ID: This datapill corresponds to the ID of the block containing selected button.
User: Information about the user who made the selection (useful when the message was posted in channel):
- User ID: Slack ID of the user
- User handle: User handle in Slack, used for @mentioning the user
- User name: Full name of the user in Slack
- Team ID: Slack ID of user's team
The following datapill is only available when you configure the Continue recipe if user does not click the button within input field.
- Expired: This datapill corresponds to the Expired field. Its value is true if the time specified in Continue recipe if user does not click the button within has expired.
Last updated: 5/12/2023, 3:43:15 PM