Data action and Dynamic list

Hi all, I need to create a chatbot that returns a list of results. In the data action I am shown only the first result (while in the execute step I see the entire json). I wonder if this is correct. Also, how can I show the list of results in the chatbot? I created a dynamic list and modified the collection with the data action output by connecting it to a slot, but if the json returns only one value then the result is presented correctly, while if there are more results it goes into error. this is my json: [ { "address": "Via delle Alpi, 300" }, { "address": "Via Malta, 200" }, { "address": "Via Garibaldi, 150" } ]

Hello,

Without knowing what you have defined in your Data Action (Input Contract and Request Configuration, and most importantly Output Contract and Response Configuration), it is difficult to tell you what is wrong in the Data Action.

Regards,

Thanks, I'll try to attach the screenshots:



You can modify your Output Contract to the following (select JSON for display - where it shows Simple/JSON):

{
  "type": "object",
  "properties": {
    "Addresses": {
      "type": "array",
      "items": {
        "title": "Item 1",
        "type": "string"
      }
    }
  },
  "additionalProperties": true
}

And your Response Configuration to:

{
  "translationMap": {
    "addressArray": "$[*].address"
  },
  "translationMapDefaults": {
     "addressArray": "[]"
  },
  "successTemplate": "{\"Addresses\": ${addressArray}}"
}

Regards,

Thank you for your support, Jerome, the data action works! I just have one issue with the result in the bot. The results are being appended to the same quick replies, whereas I would like to have one quick reply per result so I can select it and, using the ID, display the detailed data for the selected item. I’m definitely doing something wrong in the architect. I’m attaching the screenshots. Thanks!



Hello,

I am not really familiar with Bot Flows and Digital Bot Flows.

I assume that "Flow.Indirizzi" variable has been declared as a Collection of Strings.
In this case, in the Dynamic Slot Type (your last screenshot), you need to switch to Expression -> the drop-down list at the top - at the same level than "Values" (don't create an item/string like you have). In the expression field, you should be able to type/enter Flow.Indirizzi directly.

Regards,

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