Legacy Dev Forum Posts

 View Only

Sign Up

Using chat attributes in script

  • 1.  Using chat attributes in script

    Posted 06-05-2025 19:19

    pierrick | 2017-09-22 10:14:40 UTC | #1

    When using 3rd party chat, is it possible to retrieve the data attributes inside a script?

    I fire a request via the developer tools: <img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/8f91040de3071f716589f150e2efa234cbb45790.jpg" width="592" height="500">

    Then, using a script, I try to retrieve the value for the Customer Formatted Number attribute

    <img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/81a9e53c2097d7710ad82eb3d45a76a12360059e.jpg" width="586" height="500">

    I get this when answering a chat (see empty customer's number):

    <img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/f6eea86fec72cbd2ebdf96cb3ed0dceee2ae5633.jpg" width="540" height="500">

    I also tried using Script.Customer Formatted Number or Chat.Customer Formatted Number but it did not work.

    Is it possible to retrieve attributes from within a script? If not, is there another way to do it?


    tim.smith | 2017-09-22 16:22:41 UTC | #2

    This isn't currently possible. When you create the 3rd party chat, the attribute Customer Formatted Number will be set as a participant attribute context.Customer Formatted Number. Scripts allow inputs from participant attributes, but the participant attribute name must match the script variable name exactly. Unfortunately, script variable names can't contain periods, so the attributes set on the chat become inaccessible from the script. I've created CC-2885 to have scripts enhanced to support this use case.

    The best workaround I can think of is to use an external service to read the participant attributes of an incoming 3rd party chat and set the data to attributes with names that the script can handle.


    pierrick | 2017-09-25 11:39:20 UTC | #3

    Thanks @tim.smith. I created a service to set the attributes correctly but if the chat is sent to an agent right away, the attributes are not updated. However, if I set myself off queue, create the chat, update the attributes from the service and then set myself "On Queue", then the attributes are read correctly in the script.

    I guess the few ms that it takes to update the attributes is not quick enough for the attributes to be updated before the script reads the variables.


    system | 2017-10-26 11:41:09 UTC | #4

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


    This post was migrated from the old Developer Forum.

    ref: 1849