Genesys Cloud - Developer Community!

 View Only

Sign Up

Expand all | Collapse all

Architect ability to parse topics array from the v2.speechandtextanalytics.conversation.{id}.topics

  • 1.  Architect ability to parse topics array from the v2.speechandtextanalytics.conversation.{id}.topics

    Posted 4 hours ago
    Edited by Shane Jenkins 4 hours ago

    Hi all,

    I've browsed the forum and seen several threads over the last few years on this, but I am struggling.

    I have a trigger created using the topic name of v2.speechandtextanalytics.conversation.{id}.topics and my goal is to trigger based upon certain STA topics being detected. This trigger and it's associated workflow are both working great. 

    What I want to do is extract the topics array from the JSON object and specifically the topicName in Architect using an expression. I can get the topics array and store it as either a JSON collection or a String Collection to carve out just the topics. 

    Question: Is it possible to then parse out each unique topicName (i.e. Greeting, Closing, Escalate to Supervisor, etc) from this topics array (or JSON collection / string collection)? 

    Any ideas or has anyone succeeded in something similar? As you know the topics array here could contain 1 value or 2, 3, 4 etc. depending on how many STA topics were detected. 

    I would like to be able to extract each unique topic name so that we can display them in a nicely formed email to a supervisor later on in the workflow.

    Here is the event schema for STA Topics:

    {
      "conversationId": "string",
      "communicationId": "string",
      "recordingId": "string",
      "transcriptId": "string",
      "mediaType": "string",
      "programId": "string",
      "topics": [
        {
          "participant": "string",
          "topicId": "string",
          "topicName": "string"
        }
      ],
      "participants": [
        {
          "userId": "string",
          "queueId": "string",
          "divisionId": "string",
          "purpose": "string",
          "flowId": "string"
        }
      ]
    }

    Thanks as always,


    #Architect
    #DataActions
    #Triggers

    ------------------------------
    Shane Jenkins

    ------------------------------



  • 2.  RE: Architect ability to parse topics array from the v2.speechandtextanalytics.conversation.{id}.topics

    Posted 3 hours ago

    Hi Shane,

    We implemented something similar where we needed to process the STA topics array dynamically within a workflow.

    What worked well for us was looping through the topics array using Count(State.topics), and then using GetAt(State.topics, State.loopIndex) to access each topic object. From there, we extract the topicName (and participant where needed) for each iteration.

    Inside the loop, we either:

    • Set flags based on specific topic names for decision logic, or

    • Build a string/collection if we want to include all detected topics in a notification

    This approach handles any number of topics (1, 2, 3, etc.) since each item is processed individually within the loop.

    Hope this helps.



    ------------------------------
    Phaneendra
    Technical Solutions Consultant
    ------------------------------