When a user sends a slash command, the Flow executes Command leg logic
To set up this Global action:
Add the Step name to the Set up Global Actions (RWC) Step.
In the Step, click + Add custom action.
In Action type, select Command from the dropdown. The Set up Global Actions (RWC) Step gets a new No Name leg on the Flow tree.
Fill in Command name. A new leg gets a Command name too. The name 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.Enable the Trigger by slash command toggle.
Click + Add slash command. The following fields become available:
- Shortcut name is required, otherwise, the Step will take the Error leg
- Lable is optional
- Description is optional
The chat shows them when the chat user types
/
in the Text field.If the Label or Description are too long, they will be truncated in the chat with ellipsys.
Optionally, you can + Add slash command again. It will serve to add another set of Shortcut name, Lable, and Description to trigger the same command. For example, you can add translations in different languages, so that
/agent
and/агент
slash commands will re-rout the Flow to the same Command leg.On the Command leg, add the Steps and build the logic to be executed once the user sends the slash command in the chat.
NOTE
Two user actions, in particular clicking a button and sending a slash command, can trigger one Command leg execution. So if you want to process these Global actions the same way, enable both Trigger by button and Trigger by slash command toggles for one command.
Result
When the Flow execution reaches the Set up Global Actions (RWC) Step, its slash command becomes available in the chat.
Once the chat user types the slash symbol /
, the chat shows them the available slash commands. If there are a lot of slash commands they appear in the order as you added them in the Step. If the list of slash commands is long, the scroll is available.
NOTE
The chat user can type a slash command only at the moments when the Text field is available for them. The chat message contains the Text field only when it is built of the Request Response (RWC) with either the Text user input component or another user input component complemented with the optional Text field. It is available when the Allow manual user response toggle is enabled Request Response (RWC) in the Step.
If the chat user submits only /
symbol or an unexisting slash command, Request Response (RWC) records it as a response in the Step output. The Step proceeds to the next leg.
When the chat user submits an existing slash command, the Request Response (RWC) Step does not record it into the Step output. Instead, Set up Global Actions (RWC) takes a Command leg. The Command leg always starts a new Thread.
- If the Command Thread has RWC Steps, the chat receives their messages.
- If the Command Thread has non-RWC Steps, they get executed. Meanwhile, the chat waits until the Flow reaches the next RWC Step either in the current Thead or upon the continuation of the main Thead execution.
When the Command Thread execution reaches its end, the Flow continues the main Tread execution from the same Request Response (RWC) Step where it was rerouted to Set up Global Actions (RWC). Request Response (RWC) resends its message to the chat again.
To delete or change existing slash command further in the Flow
The Flow has the Set up Global Actions (RWC) Step that adds the slash command to the chat. If at a certain point in the conversation, the slash command should stop being available for the chat user, 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 slash command toggle disabled. As a result, when the Flow execution reaches the second Set up Global Actions (RWC) Step, the slash command stops being available for the chat user.
If you want to change the logic of the slash command processing, use the same principle to override the Step, enable the toggle and rebuild the Command leg Steps as you need.