Add attributes of Script used with API Genesys Cloud to create Callback

Hi all,

I have configured a Genesys Cloud custom Data Action that create callback on an existing IQF Flow.
In the Input fields of this Data Action, we enter QueueID, Callback number and Script ID.
My question is regarding the Participant Data and how to put some variables on this Script used by the Callback ?

I retrieves the variables through Set/Get Participant Data on the Architect, then I want to use them on the Script Agent to be displayed, however, the API ask only for Script ID, QueueID and Callback Number.

It is already working fine for normal Callback used on IQF.

Thank you in advance.

1 Like

Hello,

If you want to pass a set of variables/data to your callback conversation (data that will appear as participant data/attributes in the callback conversation), you can set them using the "data" attributes in the callback request.

I mean that you can send a POST to /api/v2/conversations/callbacks
With the following body:

{
  "scriptId": "37c9f4e0-83f4-11e6-8f6e-a53d3e922867",
  "queueId": "6b156afe-b9c1-49b4-82f3-6dfa5409c71c",
  "callbackUserName": "John Smith",
  "callbackNumbers": [
    "3172222222"
  ],
  "callbackScheduledTime": "2016-09-26T15:30:00.000Z",
  "data": {
      "myFirstParameter": "1234",
      "mySecondParameter": "ABCD"
  }
}

myFirstParameter and mySecondParameter will be available as Participant Data (if the Platform API conversation).

Regards,

Hi Jerome,

Thanks for your reply, you mean that I can add the variables/data in the "data" attribute of create callback API, then all these Participant Data will attached to the conversation ID returned by the API.

In order to fill automatically the data retrieved in the Scripts Fields, I think to add another API of get conversation data by ID as Custom Data Action within Script and fill automatically the fields availables on the Script.

Thank you.

Hello,

It is not necessary "to add another API of get conversation data by ID as Custom Data Action within Script".

You can define/add a variable in your script (Type String), with Name matching the Participant Data attribute name you want to retrieve (ex: nameOfYourVariable), and with the "Input" toggle enabled (i.e. Input = Yes)
You can then display it in a Text component using {{nameOfYourVariable}}

When you define a variable, and enable the "Input" toggle, it means that when the script is loaded, it will try to find corresponding attributes (participant attributes with the same name) in the conversation context, and load their value in the Script variable.

So with the example I gave above, you would defined a variable (type String), with Name = myFirstParameter, and with the "Input" toggle enabled (i.e. Input = Yes)
You can then display it in a Text component using {{myFirstParameter}}

Regards,

Hi Jerome,

Thanks for this update, when I tried the API with the Developer tools, it works fine and I can see also the data updated on the Script.

But when I try through the Custom Data Action on Purecloud, I got error of execution when I have add the "data" field as input, may be the data action is not configured properly

Below the request body of my configuration:

{"queueId": "{input.QUEUE_ID}","callbackNumbers": ["{input.PHONE_NUMBER}"],"callbackUserName": "{input.CALLBACK_USER_NAME}","scriptId": "{input.SCRIPT_ID}","data": "${input.DATA}" }

Could you tell me if this is correct ?

Thank you in advance.

Hello,

You cannot pass the entire data structure as a single parameter/input. It is a JSON object/structure.

You would have to decide on a set of participants data attributes for your Callback request and then expose each of them via a parameter/input.
I mean:
...
"data": {
"myFirstParameter": "${input.dataParam1}",
"mySecondParameter": "${input.dataParam2}"
}
...

Regards,

1 Like

Hi Jerome,

It works fine, thank you.

We put variables types string on the input Data Action within Architect, but I have only small issue, is when a variable passed into the Data Action with an empty string, the DA will exit via the Failure path.

Is there a way to handle empty string passed through variables to the API and exit through the success path ?

Thank you.

Hello,

Answer here in your other post.

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