# Process Global Commands (RWC)

Use this step to process static and text global commands.
The step might be added at any place of a flow tree. Once the step executed, global commands will be available for end-user.
Please note, that all commands (buttons) that set in Wait for Chat (RWC) step and doesn't require participation of Process Global Commands (RWC), will be available for end-user once the chat is loaded.

Logic of a global command can be overriden by adding a few steps Process Global Commands (RWC) on a flow tree (main flow or subflow) with the same name. Not overriden commands will still be available in a main flow and subflows.

# Static commands

Allows to process static commands that were defined in Wait for Chat (RWC) step.

TIP

Note, if you set global command as a link, JavaScript code or if you enable Restart conversation command, this step is not needed for their processing.

In order to handle a global command, it name mustbe specified in step. It can be done via click to + Add command and setting a command name or selecting suggested, if command name was already defined in Wait for Chat(RWC) step. This action will add additional leg to Process Global Commands (RWC) step, so when end-user clicks to global command button, the flow will be re-routed by the respective leg.

# Example:

Static commands preview

WARNING

If you set commands (that require flow re-routing) only in Wait for Chat (RWC) step and does not specify the same command name in Process Global Commands (RWC) step, the flow will be re-routed by Process Global Commands (RWC) error exit (if error handling is enabled, otherwise flow execution will be stopped).

# Text commands

Allows to process text commands from manual reply.

TIP

Note, if you do not have manual user reply options in your chat user will not be able to trigger this type of global commands.

In order to handle text command from user you have to click + Add command button and specify command name (which allso be leg name on step) and specify regex pattern for command.

Turn on toggle Stop main thread when you need to send RWC messages to chat once global command is triggered. This turned on option will ensure, that incoming messages in chat will only be from global command thread and won't create conflicts with messages from main thread. If you want to execute other logic when global command is triggered, or send events to other channel (to send email or to make a call), you can turn off this toggle, thereby main thread will not be stopped.

WARNING

If option Stop main thread is turned off and global command thread will send messages to chat, an order of messages will be random.

# Example:

Text commands preview

With setup as on example, when end-user sends text message that meets regual expression, the flow will be re-routed with Process Global Commans (RWC) step by a specific leg. In our case regular expression will check for /help message.

Text commands preview

Text commands preview

TIP

Information about how to write regular expression (regex) you can find by clicking on help button right after Flags dropdown.

# Returning to main thread

Triggering a global command (static or text), flow re-routes with Process Global Commands (RWC) step and creates new thread. After logic of global command leg is executed, end-user needs to be returned to main chat thread. In order to do this, Return to Main Thread (RWC) step should be added at the end of global command leg logic. The step will re-route flow back to the point where end-user left off the main conversation. Otherwise, the conversation will be ended.

# Conversation

Specifies conversation where message will be sent. There are two options how conversation can be set:

  • Manual
  • Automatic

# Manual

In order to manually specify conversation you have to turn off the Inherit context from previous step switch in Conversation collapsible group. You will have two dropdowns where bot with RWC flows can be selected such as conversation name, that lists the merge field names of available Wait for Chat (RWC) steps in bot flows.

Manual conversation mode

WARNING

When using manual mode, beware that if you want to move or clone flow to another bot/account you would need to re-set proper bot and conversation values for each step as bot ID and conversation ID will be different.

This behavior will not occur when using automatic mode.

# Automatic

Automatic mode allows step to inherit conversation from previous step. In order to switch step to automatic conversation mode. turn on Inherit context from previous step switch in Conversation collapsible group.

Automatic conversation mode

When there is no previous RWC step that current step can reference from, conversation will be inherited from Wait for Chat (RWC) step.

WARNING

The feature to Inherit context from previous step if available only in RWC tookit form v4.3.x.

Be careful when mixing different conversations in a flow: if one step has manual conversation mode and sends message to different conversation, a next step with inherited contest will also send message to that conversation.

# Merge field settings

The output data of the step will be stored under the name provided in merge field name. It includes the unique identifier of the command listener and names of added legs.

Last Updated: 11/16/2022, 6:09:41 PM