Legacy Dev Forum Posts

 View Only

Sign Up

Chats attributes not binding to scripts

  • 1.  Chats attributes not binding to scripts

    Posted 06-05-2025 19:09

    Jacek_Gorgon | 2017-12-11 19:49:09 UTC | #1

    I am creating a chat using /conversations/chats endpoint and including an attribute that I need to display in a chat script. I've been following https://help.mypurecloud.com/articles/script-input-output-variables/ to make sure the variable is assigned correctly.

    This is the API call:

    <img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/515e218a4a06880de4024838c05f8e76939d45c7.png" width="683" height="500">

    The interaction pops up correctly, but the attribute doesn't bind to script:

    <img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/8d31d8206749d83262023ea4938d2f83cd244340.png" width="690" height="379">

    I don't have the webchat embedded on any page, the system invokes the chats programmatically upon certain external events, so I can't rely on the browser API explained here: https://developer.mypurecloud.com/api/webchat/

    What am I missing?


    tim.smith | 2017-12-11 20:05:12 UTC | #2

    Unfortunately, this isn't possible at this time. Creating a 3rd party chat using POST /api/v2/conversations/chats adds the prefix context to your attributes. This makes your input of scripterFooVar1 get set as context.scripterFooVar1. Scripts require input variable names to match participant attribute names exactly, and cannot contain periods. Due to the way the attribute is set and the limitation on script variables, there is no direct way to use an attribute set by that API as an input variable in a script.

    As a workaround, you'll need to use a custom Data Action in your script to make API requests to access the participant data on the conversation and set that data to script variables.

    I've added your request to CC-2857 which exists to support this feature, but is not currently scheduled for work.


    Frederick_Joshua | 2017-12-12 17:16:28 UTC | #3

    On the development team we took at look at the lift to get input and output variables to play nice with 3rd party chat variables. After some looking yesterday we believe we have the code in place to handle this case now. I am looking to deploy the code into the test environments before the holidays and then in the early part of January get it deployed to production for use. We just need to get testing around this before hand.


    Jacek_Gorgon | 2018-01-03 13:21:09 UTC | #4

    Is there an ETA on this?


    Frederick_Joshua | 2018-01-03 13:35:27 UTC | #5

    The code is out in our lower environments now being tested. If all goes well we will look to get it out in the next few weeks.


    system | 2018-02-03 13:42:02 UTC | #6

    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: 2219