Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Configuring proactive chat for Web Messaging

Updated on October 11, 2023

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 window 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.
Before you begin:
  1. In the Digital Messaging Manager window, edit your Web Messaging connection, and then click the Proactive chat tab.
  2. Click Add trigger.
  3. 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
  4. In the Display name field, enter a label to identify the trigger.
  5. 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.
  6. Turn on the Enabled switch.
  7. Click Add.
  8. 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.
  9. 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>
  10. To define and embed more triggers on your website, repeat steps 2 through 9.
For example:

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:

The proactive trigger configuration settings for Web Messaging
The proactive trigger configuration settings on the Digital Messaging Manager page for Web Messaging.
What to do next: Embed the code on your website, for example, the saved code snippet in step 9.
  • Previous topic Native virus scanning in Web Messaging with Digital Messaging
  • Next topic Setting up the IVA for WhatsApp

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us