Anticipate user actions outside of the communication scenario
Set up Global Actions (RWC)
When you implement the communication scenario in messages, your bot leads your user through the conversation. It is the best practice in conversational design. The flip side of the guided conversation is that the user can do nothing but reply to the bot's messages. What if a user needs to do another action in the chat? For example, your communication scenario does not cover a rare use case, which is why the conversation becomes irrelevant to the user. In this case, we anticipate the user closing the chat or asking for help from the human agent. You can complement your chat with these actions. Use the Set up Global Actions (RWC) Step template to add these user actions to the chat and build the logic to process them.
In this Step, you can set up three user actions that will be processed as Global actions:
- A user closes or reloads the chat page
- A user clicks a Global action button
- A user submits a slash command via the Text field of the chat instead of a response
Performing one of these actions triggers Global action execution, if you configured the Step accordingly. For example, you can let the user request help from the human agent by clicking the Help button or sending the "help" slash command instead of a message anytime during the conversation. The user can always close the RWC browser page or App, but you can create a Global action to process chat closure with extra logic. For example, when a user closes the chat you can clean the local storage and delete the cookies.
The Set up Global Actions (RWC) Step lets you build the Global action processing in the Flow or on the client. Some logic you can only build and execute on the backend by adding Steps on the extra leg of the Flow. Whereas other logic should be built on the frontend by executing extra JavaScript on the client.
Global actions processed in the Flow
To execute Global action logic in the Flow, set up Global action to be processed as a Command, then the Set up Global Actions (RWC) Step gets an extra leg, where you can add the necessary Steps and build the execution logic. For example, you want to collect statistics about users' dropouts in the middle of the conversation and follow up with these users in another communication channel, like email or SMS. It is possible to build this logic only in the Flow. That is why you need to enable the predesigned Process chat close event Global action and choose to process it as a Command. On the newly-generated leg, add Steps that record user dropout data and send them a follow-up email or SMS. It is possible to build this logic only on the extra leg in the Flow. Same with the Help button and the "help" slash command to request assistance from the human agent in the chat. Their logic can only be built with the means of an extra leg.
Global actions processed on the client
Meanwhile, if Global action needs to manipulate chat page resources and chat frontend, it is better to build Global action execution on the client. The Set up Global Actions (RWC) Step allows building Global actions that run JavaScript code execution right on the chat page. For example, when the user closes the browser chat page, you may need to clean its local storage and delete the cookies. To set it up, turn on the predesigned Process chat close event Global action, choose to process it as JavaScript code, and write the necessary script. Another example is to complement the chat with a button that increases its font size to adapt a chat for visually impaired people. To create this button, add a custom action in the Step, choose to process it as a Button, set up its Icon and Lable, select JavaScript code as an Action type, and finally, provide the script that changes the chat font size.
Conclusion
All in all, Global actions complement the communication scenario between the user and the bot. A user can send a slash command to a bot, click a button, close or reload the chat page. These actions are processed either in the Flow or on the client according to their architecture. Global actions serve as an addition and alternative to what a user can do in the chat aside from replying to the bot.
Further reading: Set up Global Actions (RWC) article.