Accessing website data when using Pega Intelligent Virtual Assistant (IVA) for Web Messaging in Pega Platform 8.6
Pega Intelligent Virtual Assistant™ (IVA) is a chatbot technology that interacts with an application by sending and receiving text messages from users, in a simple question and answer form. By interacting with an IVA through various social messaging platforms, users can resolve issues or address questions and other concerns. You will learn to set up an IVA to access additional customer details from the client web browser during web messaging and how you can later use this data during case processing.
To set up an IVA for Web Messaging, a channel developer first creates a Digital Messaging channel in Pega Platform™. For more information about setting up a Digital Messaging channel in the system, see Creating a Digital Messaging channel on Pega Community.
Once you created a Digital Messaging channel, you can add a Web Messaging connection from the Digital Messaging Manager. To ensure an embedded widget enables web messaging from your website, you include the generated code snippet from the Digital Messaging Manager on your website. The code snippet is displayed on the Installation tab for your Web Messaging connection in the Digital Messaging Manager.
The Digital Messaging Manager sends some information to the Pega Platform server from the website, in addition to what the customer enters in the chat widget. The additional information that the Digital Messaging Manager sends to the system is classified into general information and custom chat context data that the system configures using tags and cookies.
General information
General information refers to the following data:
- IP address - Retrieves the IP address of the customer's device.
- Browser/Device - Retrieves the browser or the device from which the customer is interacting with the chatbot.
- Location - Retrieves the customer’s physical location.
- Current page - Retrieves the name of the web page on the website from which the customer is interacting with the chatbot.
You configure these settings on the Context data tab for the Web Messaging connection by selecting one or more check boxes listed in the Digital Messaging Manager. The Pega Platform server accesses these details without additional configuration on the website.
Tags
You configure tags to obtain selected customer metadata that help you in analyzing the customer’s intent. You can present this information to a customer service representative (CSR), even before the customer starts a live conversation. You configure this information on the Context data tab, in the Tags section of the Web Messaging connection. When a customer starts an interaction, the system retrieves the defined tags from the website and sends them to the Digital Messaging Manager. To add a new tag, click Add and enter a display name and corresponding tag in the Display Name and Tag fields. In the Display Name field, enter the data point name. In the Tag field, enter the tag that corresponds to the display name field.
Once you defined the tags, on the Installation tab, click Copy to copy the code snippet that you need to embed on the client website, so that the system can send tags back to the Pega Platform server. Therefore, unlike general information, sending custom context data by using tags requires modification on the client website
Note: You can only enter alphanumerical characters in the Tag field without any spaces and special characters.
You can later present the received context data to a CSR who might start a live conversation at the end of the chatbot conversation, as shown in screenshot below
Note: To learn more about how the system uses this information in a Customer Service application, see Context data for Web Messaging on Pega Community.
The Digital Messaging Manager can also retrieve cookie values from a website. By default, the system retrieves no cookies. You can add cookies to retrieve in the Digital Messaging Manager, on the Security tab of the Web Messaging connection. In the Allowed cookies section, enter the cookie name in the New cookie field and then click Add.
Ensure that the cookie you add already exists with the same name on the website and the cookie is available on the webpage when the customer initiates a chat interaction, by using the inspect option and checking for application cookies.
Accessing additional information at runtime
When a customer accesses a client website which includes the embedded Javascript code snippet, the chat widget will be visible. Clicking on this widget starts a connection with the Digital Messaging service which displays the Display Message configured for the Web Messaging connection. When the customer enters their first message in the chat widget, the system creates an instance of work object of the Work-Channel-Interaction-BotAgent class. The system appends each inbound and outbound chat message to the pyHistory pagelist for this work object. All the information set using tags and cookies is available on each page in the pyHistory pagelist. You can access the general information, location, IP address, device type, as well as context data that is sent as tags on a page entitled pyInboundMessage.pyMetadata.pyRequestDetails.pyContextData in the pyHistory pagelist. You can access the information sent using cookies on a page entitled pyInboundMessage.pyMetadata.pyRequestDetails.pyCookies in the pyHistory pagelist.
The following screenshot shows the clipboard structure for an Interaction case:
pyContextData is a pagelist that stores information in the form of a key and value pair. pyKey property stores the name of standard information, for example, IP address, device, current page or the tag name. The pyValue property stores a value that the system receives from the client website.
pyCookies is a pagelist that stores cookie information in the form of a key and value pair.
pyKey property stores the cookie name that you defined in the Web Messaging connection and pyValue property stores the cookie value.
The clipboard pages described above only apply to interactions that take place using Digital Messaging service and Pega Platform version 8.6. The clipboard structure and class instances are different when the interaction takes place using Pega Customer Service application which includes a wrapper case of PegaCA-Work-Interaction-VA-BotAgent class. When a Customer Service application starts a chat interaction, the system instantiates a work object of this class. This class contains a direct inheritance to the Work-Channel-Interaction-BotAgent class.
Using cookies for case processing
If you want to use these cookie values within your application for case processing, you do not have to loop through the Interaction workobject and the pyHistory pagelist. Instead, the system includes a top-level clipboard page that is available for each interaction entitled RequestDetails belonging to the Embed-BotAgent-RequestDetails class. This clipboard page includes the pyCookies and pyContextData pagelists, which you can reference in rules within the case created by the chat interaction. The following is an example of a use case where you use this information for case processing.
Example
If a customer is trying to report a complaint by using your website, you can save the customer ID as a cookie value, if the customer is logged in to the website with their credentials. In this situation, the system can retrieve and prepopulate the customer's general details, instead of explicitly asking for these details again. As a result, you can skip certain steps from the conversational flow that ask for basic information, if the cookie value was retrieved and is available. In a case the cookie value is not available in the system, the conversational flow will ask the customer for basic information, for example, their name and address. You can use a data transform in the conversational flow that is shown below to automatically obtain the cookie value from the RequestDetails page and set the value in the Complaint case primary page. In the screenshot shown below, the cookie value is set to .Contact.pyID page of the Complaint case that the system created in the chatbot interaction. The conversational flow in the case can then conditionally branch based on the value in .Contact.pyID.
You successfully learned how to obtain additional information like cookies from the client website using Digital Messaging Manager and how the system uses these values to influence the case processing logic.