Genesys Cloud CX

 View Only
Discussion Thread View
  • 1.  Manually setting participant data via field

    Posted 09-26-2022 15:04
    Hello,

    We have a request to have a form field script where agents can enter text manually to set external participant data for an SMS interaction, and then have that data retained as the interaction flows between agents.

    Initially, we just created a form field in a script which we thought was working, but the data was being set on the internal participant. After poking around, a colleague found some info on the field needing to have initial data before it can be set for the external participant, so in our test flow we're manually setting that field to null and then overwriting it via the script field once an agent gets the interaction. This works to correctly set the data under the external participant and we're able to see the data via the API calls we're using, however, if the same end user texts back in once the interaction has been completed (within the 72 hour threading period) the flow again sets this field to null which means the next agent has to gather and set the info again.

    Our goal would be to set this data set manually the first time and then not wipe it out on future threaded interactions. Is anyone able to point to a better way of doing this where we don't have to set the data initially via the flow, or a way to check for content other than null and ignore setting it if there's already data?

    Thanks,
    #ArchitectureandDesign
    #DigitalChannels
    #Implementation

    ------------------------------
    Duncan Maloch
    Sonic.net
    ------------------------------


  • 2.  RE: Manually setting participant data via field

    Top 25 Contributor
    Posted 09-26-2022 15:53
    We use a data action in the Script to update participant data

    we know the external participant id from the built in variable {{Scripter.Customer Participant ID}}
    and we know the conversation id from the built in variable {{Scripter.Interaction ID}}
    So we can use the API PATCH /api/v2/conversations/calls/{conversationId}/participants/{participantId}/attributes
    to update the Participant Data, and is retrievable in following flows with Get Participant Data actions.

    In your inbound flow you can always check the values of a variable and then update if it is not set, and if it is set to leave it alone, IsNotSetOrEmpty() is your friend here. eg:


    ------------------------------
    Anton Vroon
    ------------------------------



  • 3.  RE: Manually setting participant data via field

    Posted 09-26-2022 15:59
    Ahh perfect, thanks!

    ------------------------------
    Duncan Maloch
    Sonic.net
    ------------------------------



  • 4.  RE: Manually setting participant data via field

    Posted 09-27-2022 11:31
    Sorry to bring this one back to life, but I tried this a few different ways and can't seem to get it working, so I figured I'd provide more detail:

    We have a script with an input/output variable of {{Username}}

    In the flow, we have a set screenpop step. If I just leave the input field alone, I can set a Username for the external participant during an interaction and when I pull that interaction up, the Guest's "Username" field retains the data, until we message in again, at which point it's blank. This is without any other steps in the flow.

    I've tried adding the get participant data action to pull up the Flow.Username field as well as added the decision tree, but the same results happen, so I think I'm missing something as far as storing this participant data through multiple agent interactions even without the rest of this. We're fairly new to scripting in Genesys as well as doing anything outside of the basics in Architect, so I'm sure we're just doing something wrong and any help is appreciated.

    Thanks

    ------------------------------
    Duncan Maloch
    Sonic.net
    ------------------------------



  • 5.  RE: Manually setting participant data via field

    Posted 09-27-2022 13:14
    I think the main issue here is that our input field in the script isn't actually storing the variable for persistent sessions. I see there is a "Scripter Set Variable" option but I'm not seeing how to actually select it, it's just in a list of text. I suspect once we've corrected this, the rest of it will make sense, but I'm stuck on that first step.

    ------------------------------
    Duncan Maloch
    Sonic.net
    ------------------------------



  • 6.  RE: Manually setting participant data via field

    Top 25 Contributor
    Posted 09-27-2022 15:08
    Edited by Anton Vroon 09-27-2022 15:11
    If I'm reading it right, I think you are running in to the same issue we did initially, setting a variable to Output, does not make it available through the Get Participant Data Actions

    Output in scripts is more for external apps to process and use. Which is odd, its easier for an external app to grab that data than it is for a Genesys flow to.

    From the Documentation on Output variable

    "The Output property makes it possible to store the value of a script variable for use after a call ends, without having to set up a data action, or add supplemental columns to a contact list. When Output is set to Yes, the value of this script variable is written to the conversation object. Its saved value may be programmatically retrieved by a customer's external process. To use a variable as an output variable, enable Output. When the value of this variable changes during execution of a script, the conversation object is updated in 3 seconds."

    To use a variable set in the the agent script, in subsequent flows, you want to use a DataAction calling the API:
    PATCH /api/v2/conversations/calls/{conversationId}/participants/{participantId}/attributes

    Using  {{Scripter.Customer Participant ID}} or the particpant id and {{Scripter.Interaction ID}} for the ConversationID
    The body in the DataAction setup is going to be something like {"attributes": {"Variable1": "${input.Variable1}", "Variable2": "${input.Variable2}"}}
    Where Variable1 and Variable2 are the names of the Data items you are wanting to set.

    Using this method, does let you use the Get Participant Data action to retrieve those variable later, if it is part of the same ConversationID


    Edit: Also just thinking, and we don't use External Contacts so my knowledge here is more limited, but my understanding is if you setup the customer in your External Contacts, whenever that number calls or sends an sms it will show their name to the agent.

    ------------------------------
    Anton Vroon
    ------------------------------



  • 7.  RE: Manually setting participant data via field

    Posted 09-29-2022 16:20
    Thanks for your help on this, wanted to post an update with our solution in case anyone else runs into the same issue.

    We achieved what we were looking for by having the script with the text input/output field using a variable called {{Username}}

    Then, in the in-queue message flow, we created a Get Participant Data action looking for the Flow.Username variable, and then called the Script using that variable. This seems to properly populate that script field during an interaction if the field was previously populated by an earlier agent in the 72 hour threading period.

    I'm unsure why it wasn't working before, although I suspect having the script set as the default script at the queue level, or having this on the inbound flow instead of in-queue may have been part of it.

    ------------------------------
    Duncan Maloch
    Sonic.net
    ------------------------------