Genesys Cloud - Developer Community!

 View Only

Sign Up

Error in passing a dynamic array of JSON objects using Data Action

  • 1.  Error in passing a dynamic array of JSON objects using Data Action

    Posted 12 hours ago
    Edited by Subhajit Podder an hour ago

    I want to pass a dynamic array of JSON objects using Data Action. I've created the input with the help of a discussion in community, but I am getting below error. 

    contract.input.inputSchema.properties.responses.type: must be equal to one of the allowed values: [boolean, integer, number, string, null].

    Community URL - Click Here

    Input Sample - 

    {

        "payload": {

            "interaction_id": "23e4ee90-aacc-44b8-9f07-4df887713deb",
            "responses": [
                {
                    "id": 1,
                    "value": "FTSM"
                },
                {
                    "id": 4,
                    "value": "C4D2"
                }
            ]
        }
    }

    Input JSON structure in Data Action - 

    {
      "title": "payload",
      "type": "object",
      "required": [
        "interactionId",
        "responses"
      ],
      "properties": {
        "interactionId": {
          "type": "string"
        },
        "responses": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id",
              "value"
            ],
            "properties": {
              "id": {
                "type": "integer"
              },
              "value": {
                "type": "string"
              }
            }
          }
        }
      }
    }

    Is it really possible to send the dynamic JSON array or any kind of array as an input of Data Action?  Because, in contract I didn't find any option to pass array as an input.

    If not, then what will be the best way to send the JSON array as Data Action input? Passing the JSON collection as a string and handle in backend?

    What will be my body of the Data Action in this case?


    #Architect
    #DataActions

    ------------------------------
    Subhajit Podder
    NA
    ------------------------------