A new functionality has been added to USD, triggering a new event if a client uses EngagementAttributes.
Event name: EngagementAttributesAvailable
Description: If the client uses EngagementAttributes on their website that hosts the chat widget, whenever a new chat is accepted, the USD event EngagementAttributesAvailable will be triggered and contain the engagement attribute data in JSON string format.
Hosted Control: Chat Control
The following information will show how to set up this new event and how to use it.
Configuration of EngagementAttributesAvailable Event
1. Access one of the Microsoft Dynamics applications and go to the Advanced settings.
2. Click on the Settings dropdown and then select Unified Service Desk.
3. Under Unified Service Desk settings, choose Action Calls.
4. Click the New button to start creating a new action call.
5. Fill up the new action call form using the data below. Don't forget to hit the Save button after completing the form.
Name: Action Call for Engagement Attributes Available
Hosted Control: Agent Scripting
Action: Popup
Data (Example Only): url=http://www.test.com?engagementattributes=[{\"personalInfo\":{\"serverTimeStamp\":1675863891834,\"personalInfo\":{\"name\":null,\"surname\":null,\"customerAge\":null,\"contacts\":null,\"gender\":null,\"company\":\"TEST_ENCRYPTED_AUTH_STRING_500_CHARACTERS_MAX{\"page\":{\"id\":\"665186317\"}}}}]
6. Go back to the Unified Service Desk settings and choose Events.
7. Click the New button to start creating a new event.
8. Fill up the new event form according to the data below. Don't forget to hit the Save button after completing the form.
Name: EngagementAttributesAvailable
Hosted Control: Chat Control
9. After saving, stay on the form and click the plus icon on the right. Search for the newly added Action Call for Engagement Attributes Available and add this to the active actions of the EngagementAttributesAvailable event.
Testing the EngagementAttributesAvailable Event
1. Open the browser developer console on the consumer's website and run the sample script below. Then initiate the chat conversation by clicking the Live Chat widget.
lpTag.sdes = lpTag.sdes||[]; lpTag.sdes.push(
{ "type": "personal",
"personal": {
"company": "TEST_ENCRYPTED_AUTH_STRING_500_CHARACTERS_MAX" } });
3. The Engagement Attributes are returned and trigger the event EngagementAttributesAvailable in USD.
4. The USD Chat Context will be updated with the EngagementAttributes.
Note: variables can be accessed using [[ChatContext.EngagementAttributes]]
Example: "[{\"personalInfo\":{\"serverTimeStamp\":1675863891834,\"personalInfo\":{\"name\":null,\"surname\":null,\"customerAge\":null,\"contacts\":null,\"gender\":null,\"company\":\"TEST_ENCRYPTED_AUTH_STRING_500_CHARACTERS_MAX{\"page\":{\"id\":\"665186317\"}}}}]"
5. Custom Action Calls can be added to the EngagementAttributesAvailable event in USD, and these action calls can access the EngagementAttributes.
In the basic example action call shown, a popup window is opened with the engagement attributes added to the query parameter:
URL: http://www.test.com?engagementattributes=[{\"personalInfo\":{\"serverTimeStamp\":1675863891834,\"personalInfo\":{\"name\":null,\"surname\":null,\"customerAge\":null,\"contacts\":null,\"gender\":null,\"company\":\"TEST_ENCRYPTED_AUTH_STRING_500_CHARACTERS_MAX{\"page\":{\"id\":\"665186317\"}}}}]
USD Debugger Example Logs
Action Call# 1
Source:Event(Chat Control)
Name:EngagementAttributesAvailable
Application:
Action:
Action Data:
Parameters:"PostData"="{"browserType":"","browserVersion":"","browserUserAgent":"","sourceUrl":"","customer": {"os":"WINDOWS","country":"","city":"","isp":"","device":"DESKTOP","pageHistory": [],"ipAddress":"82.7.115.89","email":"","firstName":"","lastName":"","id": {"value":"7062c363685cd73ea5cf7f8cf664f523993d25aaa25c67c3a0216ca00f8a6969","isAuthenticated":false},"language":"en- US","sharkVisitorId":"7062c363685cd73ea5cf7f8cf664f523993d25aaa25c67c3a0216ca00f8a6969"},"chat": {"activityId":"","conversationId":"d6b8c6b2-ed03-44a0-9052-976966c505cc","skills":[""],"transferredFrom":[],"prechatSurvey": [],"startTime":"2023-02-08T13:46:47.658Z","endTime":"","rtSessionId":"32157713_d6b8c6b2-ed03-44a0-9052- 976966c505cc"},"agent":"Agent Name","lastActiveTimeInMillis":1,"engagementAttributes":"[{\"personalInfo\": {\"serverTimeStamp\":1675863891834,\"personalInfo\": {\"name\":null,\"surname\":null,\"customerAge\":null,\"contacts\":null,\"gender\":null,\"company\":\"TEST_ENCRYPTED_AUTH_STRING_500_CHARACTERS_MAX{\"page\":{\"id\":\"665186317\"}}}}]"}"
Action Call# 2
Source:RoutingRule(Agent Scripting)
Name:Default
Application:
Action:
Action Data:
Parameters:"url"="*"
"type"="Popup"
"order"="10001"
"SUBJECTURL"="http://www.test.com?engagementattributes="[{\\"personalInfo\\": {\\"serverTimeStamp\\":1675863891834,\\"personalInfo\\": {\\"name\\":null,\\"surname\\":null,\\"customerAge\\":null,\\"contacts\\":null,\\"gender\\":null,\\"company\\":\\"TEST_ENCRYPTED_AUTH_STRING_500_CHARACTERS_MAX{\"page\":{\"id\":\"665186317\"}}}}]"}"
Action Call# 3
Source:Event(Agent Scripting)
Name:PopupRouted Application:
Action:
Action Data:
Parameters:"url"="http://www.test.com?engagementattributes="[{\\"personalInfo\\": {\\"serverTimeStamp\\":1675863891834,\\"personalInfo\\": {\\"name\\":null,\\"surname\\":null,\\"customerAge\\":null,\\"contacts\\":null,\\"gender\\":null,\\"company\\":\\"TEST_ENCRYPTED_AUTH_STRING_500_CHARACTERS_MAX{\"page\":{\"id\":\"665186317\"}}}}]"}"
Action Call# 4
Source:Event(Chat Control:EngagementAttributesAvailable)
Name:Action Call for Engagement Attributes Available
Application:Agent Scripting
Action:Popup
Action Data:url=http://www.test.com?engagementattributes="[{\"personalInfo\": {\"serverTimeStamp\":1675863891834,\"personalInfo\": {\"name\":null,\"surname\":null,\"customerAge\":null,\"contacts\":null,\"gender\":null,\"company\":\"TEST_ENCRYPTED_AUTH_STRI {\"page\":{\"id\":\"665186317\"}}}}]"
Parameters:"PostData"="{"browserType":"","browserVersion":"","browserUserAgent":"","sourceUrl":"","customer": {"os":"WINDOWS","country":"","city":"","isp":"","device":"DESKTOP","pageHistory": [],"ipAddress":"82.7.115.89","email":"","firstName":"","lastName":"","id": {"value":"7062c363685cd73ea5cf7f8cf664f523993d25aaa25c67c3a0216ca00f8a6969","isAuthenticated":false},"language":"en- US","sharkVisitorId":"7062c363685cd73ea5cf7f8cf664f523993d25aaa25c67c3a0216ca00f8a6969"},"chat": {"activityId":"","conversationId":"d6b8c6b2-ed03-44a0-9052-976966c505cc","skills":[""],"transferredFrom":[],"prechatSurvey": [],"startTime":"2023-02-08T13:46:47.658Z","endTime":"","rtSessionId":"32157713_d6b8c6b2-ed03-44a0-9052- 976966c505cc"},"agent":"Agent Name","lastActiveTimeInMillis":1,"engagementAttributes":"[{\"personalInfo\": {\"serverTimeStamp\":1675863891834,\"personalInfo\": {\"name\":null,\"surname\":null,\"customerAge\":null,\"contacts\":null,\"gender\":null,\"company\":\"TEST_ENCRYPTED_AUTH_STRING_500_CHARACTERS_MAX{\"page\":{\"id\":\"665186317\"}}}}]"}"{\"page\":{\"id\":\"665186317\"}}}}]"}"