How to Configure Pre-Chat Customer Authentication for Pega DM

We are trying to configure Pre-Chat authentication in Pega Digital Messaging.

In the customer website we are going to log in and then start the Pega Digital Messaging Chatbot. Our requirement is that Chatbot can recognize the customer by having the customer data.

We have already gone through the document https://docs.pega.com/bundle/customer-service/page/customer-service/uikit-implementation/chat-messaging/customer-authentication-using-private-data-api.html.

But it is not very clear what we need to configure it in Pega end and what need to be configured in Website end.

Could anyone help us regarding that?

We are using Pega 23.1.1

@SayanR23

Attached is an example of the code which needs to be implemented on the client side. The following configuration steps should be taken to implement this feature:

  1. Navigate to the Digital Messaging manager, Channels and Interfaces > Digital Messaging > Connection > Manage Connections

    1. Within the Digital Messaging Manager, navigate to the active Web Messaging connection and head to the security tab. In the security tab, enable the configuration ‘Control chat session initialization’ seen in the screenshot
  2. On the client side page, refer to the sample application attached, as the following logic should be implemented

    1. Using the JWT secret on the same security page in Digital Messaging manager, create a request to create a session signed with JWT token:
  3. reateNewPrivateChatSession = async(uuid,proactive_trigger) => {

  4. var token = generateJWTToken(MESSAGING_WIDGET_ID);

  5. const options = {

  6. headers: {

  7. ‘Content-Type’: ‘application/json’,

  8. ‘authorization’: 'Bearer ’ + token

  9. }

  10. };

b. Once the session has been created, retrieve the Session ID

response = await axios.post(‘https://widget.chat.pega.digital/’ + MESSAGING_WIDGET_ID + ‘/create’, data, options);

let sessionId = response.data.sessionId;

console.log("generated session ID: " + sessionId + " for customerId " + (uuid ? uuid : “anonymous”));

console.log("proactiveTrigger: " + proactive_trigger);

return sessionId;

}

c. Finally, call the Private Data API and send over the Session ID and customer identifier, which will be exchanged into the Pega Appliction alongside the incoming messages. The customer identifier will be seen in the messaging interaction under ‘pyCustomerPrivateData’

//Call private data API in digital messaging

callPrivateDataAPI = async(arg_sessionId, uuid) => {

var token = generateJWTToken(arg_sessionId);

const options = {

headers: {

‘Content-Type’: ‘application/json’,

‘authorization’: 'Bearer ’ + token

}

};

//make request

try{

var res = await axios.post(‘https://widget.chat.pega.digital/4d88d63c-b3d9-49ee-8f77-adeb5d4fc223/widget.js’, { customerId: uuid }, options);

} catch(err){

console.log(err);

}

}

PrivateSession_Data_Example(1)_0.zip (2.31 MB)