Set Participant Data via API

Hello,

I'm looking for a way to allow an agent to overwrite a participant data value on the conversation their currently handling. Is there an API I can include in action assigned to a script button or something similar that will allow them to do this?

Thanks,
Mo

Hello,

I can think of two possible approaches using a Script.

First one does not require a Data Action if it is for inbound conversations and if the Participant Data you are trying to update is stored at the customer's participant level (I mean participant with purpose=customer in the conversation context).
Note: As an example, it will be the case if your participant data was set/attached from an Architect flow.
In this case, you could define a Script variable with Input and Output enabled - the variable name matching the participant data keyname.
Input will allow the Script to read the current value when it is loaded.
If you modify the Script variable (with Output enabled on the variable), it will automatically update the participant data with the new value.
You are not obliged to expose the variable in an input/text field to allow its change. You can have a button, which leverages the Set Variable action, to update the value of the variable.
Even if you don't expose the variable via an Input/text field, be sure to create the variable with Input enabled. Otherwise Script will update the Participant Data automatically (to empty string value) when the Script loads.

Second approach would be to define a Genesys Cloud Data Action to update the Participant Data, and to invoke the Data Action from the Script using an Execute Data Action.
For the Genesys Cloud Data Action, You can leverage this endpoint: PATCH /api/v2/conversations/{conversationId}/participants/{participantId}/attributes
Then, in your Script, you can execute this Data Action using "Scripter.Interaction ID" as the conversationId and "Scripter.Customer Participant ID" as the participantId.

Regards,

1 Like

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