Skip to content

When a user clicks a button, the Flow executes Command leg logic

To set up this Global action:

  1. Add the Step name to the Set up Global Actions (RWC) Step.
  2. In the Step, click + Add custom action.
  3. In Action type, select Command from the dropdown. On the Flow tree, the Set up Global Actions (RWC) Step gets a new No Name leg.
  4. Fill in Command name. It must contain only letters and digits up to twenty symbols. The field is case-sensitive. For example, Info, info, INFO are the names of three different commands. A new leg gets a command name too.
  5. Enable the Trigger by button toggle.
  6. Choose the button icon from Google Material Icons. In Icon, write its name from the website in snake case. For example, shopping_cart. The integration will upload the icon to the RWC client.
  7. In Lable, write what the user will see when hovering over the button icon in the chat.
  8. On the Command leg, add Steps to build the logic of how the chat will process the user's button click.

NOTE

Clicking a button and sending a slash command can trigger the same Command leg execution. So if you want to process these Global actions the same way, enable both the Trigger by button and Trigger by slash command toggles for one custom action of the Command type.

Result

When the Flow reaches Set up Global Action (RWC), the button becomes available in the chat.

Once a user clicks it, the Flow rerouts to the Command leg of the Step. The Command leg always starts a new Thread. Its logic gets executed:

  • If the Command thread has RWC Steps, the chat receives their messages. When the Command thread execution reaches its end, the Flow returns to the main Thread to the same Step where it was interrupted. This Step resends its message to the chat again.
  • If the Command thread has non-RWC Steps, it gets executed in parallel with the main Thread. The main thread of the chat does not pause.

To remove or change the existing Global command button

The Flow has the Set up Global Actions (RWC) Step that adds the Global command button to the chat. If at a certain point in the conversation, you want to hide the button from the chat or change how it is processed, override the Step.

Add the second Set up Global Actions (RWC) below the first Step further in the Flow. The names of the two Steps can be different. Set up the Step according to the instructions above, but in the Command name field provide the value from the first Step. Leave the Trigger by button toggle disabled. As a result, when the Flow execution reaches the second Set up Global Actions (RWC) Step, the button hides from the chat.

If you want to change the logic of logic of how to proccess the button click, use the same principle to override the Step, enable the toggle and rebuild the Command leg Steps as you need.