Get Participant Data for Web Chat Widgets in Architect

Trying to read the attributes attached to the chat in Architect. But I am having some strange results.

  1. I am using the Web Chat tool https://developer.mypurecloud.com/developer-tools/#/webchat
  2. Using Widget 1.1:
  3. To get at a specific attribute, other posts mentioned using Get Participant Data with an expression like Chat.Guest.CustomFields[0].value
  4. Strangely, when I use .value, nothing is returned, but when I use .key I actually get the value as in Chat.Guest.CustomFields[0].key.
  5. Here is my flow in Architect to iterate through the keys of Chat.Guest.CustomFields:
  6. The output is:

0--oradaazo@hit.edu
1--619 Vono Pike
2--(258) 751-3869
3--
4--32956
5--Jazuzi
6--DF Mainstream Counselling
7--Ollie
8--
9--
10--
11--Moretti
12--TX
13--Cat
14--true
15--Dog

My objective is to retrieve the attached data so that I can, within Architect, make decisions to auto reply with a specific message and customize the routing.

My questions:

  1. Why is the data in .key and not .value?
  2. Can you access any and all of the data entered in the website form using Get Attribute? If yes, how?

Thank you

I don't have an answer to why key/value aren't set properly, that is a good question, but you can use the Get Participant Data step to get the attribute context.customfieldname

Thank you for your help!

I did find a clue regarding the use of context in the Web Chat documentation here on the developer site but wasn't referencing it correctly as a string/literal. The documentation in the Resource Center needs to be added or updated to explain better how these attributes are available.

But basically, however the data "collection" in the chat config script is setup is how, in Architect you can reference the attached data. For example, the Web Chat Developer Tool widget (v 1.1) the data collection looks like:

  "data": {
    "firstName": "Ollie",
    "lastName": "Moretti",
    "addressStreet": "619 Vono Pike",
    "addressCity": "Jazuzi",
    "addressPostalCode": "32956",
    "addressState": "TX",
    "phoneNumber": "(258) 751-3869",
    "customField1Label": "Dog",
    "customField1": "Cat",
    "customField2Label": "",
    "customField2": "",
    "customField3Label": "",
    "customField3": "",
    "email": "oradaazo@hit.edu",
    "lineOfBusiness": "Sales"
  },

Then in Architect you use Get Participant Data using "context." and the field name in the data collection. Examples: context.firstName, context.phoneNumber, and context.lineOfBusiness (my custom attribute).
image

The Web Chat Developer Tool is super helpful but I would recommend that the fields Field 1 Name, Field 2 Name, and Field 3 Name are not really needed and may be misleading. While Field 1 Value, Field 2 Value, etc. make sense in being there. And of course the ability to add custom attributes is great.

BUT we still need to figure out why the Chat.Guest.customFields contains the data that it does contain and why it is being populated in the key elements.

1 Like

The field name and value are used in the PureCloud UI to display data to the agent outside of a script, under Interaction Details.

Config:

Result:

If your goal is just to have custom data on the chat, use custom attributes and not the built-in custom fields.

Aha! That makes sense. So, you cannot display the Custom Attributes in Interaction Details?

Yes, based on my tests and your advice, I agree, use Custom Attributes for the Chat.

Any idea why Chat.Guest.customFields contains the data that it does contain and why it is being populated in the key elements?

Correct. You have to use the 3 built in ones for that spot. You can display any attributes/data you like in a custom script.

Can you make a new post in the architect category about that? I'm not very familiar with Architect and a new post in the Architect category will attract the attention of someone who can answer that.

Made new post in Architect Category. Thanks for your help!

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.