Display customFields from Guest chat API

customer information is not displaying on genesys cloud script. I am using GuestChatAPI and passing member information in custom fields, I have script on Agent side which is suppose to display data that was passed under MemberInfo by guest chat API . Jason object looks like below:
{
"organizationId": "4aac8701-19df-40d7-8b4e-7f24bfb0089a",
"deploymentId" : "0bc87921-d935-44f1-a2cb-29827e35966f",
"routingTarget" : {
"targetType" : "queue",
"targetAddress": "Marketing"
},
"memberInfo" : {
"displayName" : "Joe Dirt",
"avatarImageUrl": "http://some-url.com/JoeDirtsFace",
"lastName" : "Joe"
"firstName" : "Dirt"
"email" : "joe.dirt@example.com"
"phoneNumber" : "+12223334444"
"customFields" : {
"Subject" : "arbitrary data",
"another_field" : "more arbitrary data"
}
}

On the Agent side we want display all this info under script

.

Thanks
-Sejal

Hello,

In order to use the built-in script variables related to chat in a Script, the Genesys Desktop UI & Script with Guest Chat (Chat v2) expect the different information (firstName, lastName, phoneNumber, ...) to be part of the Conversation's Participant data/attributes.
Because of this, these fields must all be sent via the memberInfo.customFields.

I mean the request would have to be like this:

{
    "organizationId": "xxx",
    "deploymentId": "yyyy",
    "routingTarget": {
        "targetType": "queue",
        "targetAddress": "Marketing"
    },
    "memberInfo": {
        "displayName": "Joe Dirt",
        "avatarImageUrl": "http://some-url.com/JoeDirtsFace",
        "customFields": {
            "lastName": "Joe",
            "firstName": "Dirt",
            "email": "joe.dirt@example.com",
            "phoneNumber": "+12223334444",
            "Subject": "arbitrary data",
            "another_field": "more arbitrary data"
        }
    }
}

or this should work as well:

{
    "organizationId": "xxxx",
    "deploymentId": "yyyy",
    "routingTarget": {
        "targetType": "queue",
        "targetAddress": "Marketing"
    },
    "memberInfo": {
        "displayName": "Joe Dirt",
        "avatarImageUrl": "http://some-url.com/JoeDirtsFace",
        "lastName": "Joe",
        "firstName": "Dirt",
        "email": "joe.dirt@example.com",
        "phoneNumber": "+12223334444",
        "customFields": {
            "lastName": "Joe",
            "firstName": "Dirt",
            "email": "joe.dirt@example.com",
            "phoneNumber": "+12223334444",
            "Subject": "arbitrary data",
            "another_field": "more arbitrary data"
        }
    }
}

The mapping between the attribute name (in the Guest Chat request - under memberInfo.customFields) and the Script built-in variables is:

Guest Chat: memberInfo.customFields.lastName
Script: {{Chat.Customer Last Name}}

Guest Chat: memberInfo.customFields.addressStreet
Script: {{Chat.Customer Street}}

Guest Chat: memberInfo.customFields.addressCity
Script: {{Chat.Customer City}}

Guest Chat: memberInfo.customFields.addressPostalCode
Script: {{Chat.Customer Postal Code}}

Guest Chat: memberInfo.customFields.addressState
Script: {{Chat.Customer State}}

Guest Chat: memberInfo.customFields.phoneNumber
Script: {{Chat.Customer Phone Number}}

Guest Chat: memberInfo.customFields.phoneType
Script: {{Chat.Customer Phone Type}}

Guest Chat: memberInfo.customFields.customerId
Script: {{Chat.Customer ID}}

There is one Chat Script built-in variable which is not working with Guest Chat/Chat v2.
Script - Not working with Chat v2: {{Chat.Customer Email}}

You can retrieve the value of the customer email and expose it using a different method.
This method is also the one to use for any custom field/attribute (like "Subject" and "another_field" you have shown in your sample request).

You can define/add a variable in your script (Type String):
With Name = the name of the custom field on Guest Chat API side (ex: email, Subject, another_field),
And with the "Input" toggle enabled (i.e. Input = Yes)
You can then display the content of the variable in a Text component using {{email}}, {{Subject}}, {{another_field}}

See this post for more information.

Regards,

Thanks, above approach is working for us.

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