Configuring proactive chat for Web Messaging
Configure proactive chat in Pega Intelligent Virtual Assistant™ (IVA) for Web Messaging to engage with users in a chat window on your website by automatically inviting them to a conversation based on certain conditions. As a result, you enhance the user experience of your website for users, so that they immediately interact with your chatbot to solve an issue or ask for help, when needed.
For example, for an online store, if the total value of a shopping cart reaches a set amount on the website, the system can automatically open the Web Messaging chat widow and display a message based on a response command for your IVA. For instance, the chatbot can display information about the available discounts for the dollar amount.- Create a Web Messaging connection for your Digital Messaging channel. For more information, see Setting up the IVA for Web Messaging.
- Define response commands for your chatbot that you will use for proactive chat on your website. For more information, see Defining response commands for a conversational channel and Adding case commands for a conversational channel.
- In the Digital Messaging Manager window, edit your Web Messaging connection, and then click the Proactive chat tab.
- Click Add trigger.
- In the Add trigger window, in the Proactive
trigger field, enter a name for the proactive trigger that you
will later reference in the embedded JavaScript code on your website.
For example: Enter 5sonPage - In the Display name field, enter a label to identify the trigger.
- In the Bot command field, enter a chatbot response
command that you want to associate with the trigger.
For example: To automatically display text in a chat window for the proactive trigger, enter a response command for your chatbot that displays a welcome message to users. - Turn on the Enabled switch.
- Click Add.
- Click Copy code snippet, and then, in the Copy
code snippet for proactive trigger window, copy the code snippet
to a text file.The available script from the Copy code snippet button is a sample of code that you can embed on the webpage from where the system launches the widget.
- In the text file, replace the $trigger_code variable with
the name for the Proactive trigger that you specified in step
3.
For example: Save the following JavaScript code snippet to a text file for a proactive trigger named 5sonPage: <script language="javascript"> function proactiveTimer() { setTimeout(() => { PegaUnifiedChatWidget.triggerChat("5sonPage"); }, 5000 ); } window.onload = proactiveTimer; </script>
- To define and embed more triggers on your website, repeat steps 2 through 9.
The following figure shows a proactive trigger definition for the Web Messaging widget that automatically displays a chat window when users stay for at least 5 seconds on a website:

Previous topic Configuring on-premises or internal access only environments for Digital Messaging access Next topic Template operator for IVA channel