0

I am working on a chatbot project where I have to create a dynamic list option. There is a list of 15 Items (first step). When user selects one, selected item should be removed from the list. After that It will return to first step (list) and will display only 14 items. Where is the issue in step 3?

Step 1: I have created a "item_list" in the memory field of one skill.

[{"item": "product_1", "value": 5},{"item": "product_2", "value": 6},{"item": "product_3", "value": 4}]

Step 2: Choose custom list and enter the following script in the same skill.

{
  "type": "list",
  "delay": "",
  "content": {
    "elements": [
      {{#eachJoin memory.item_list}}
      {
        "title": "{{this.item_list.item}}",
        "subtitle": "{{this.item_list.value}}",
        "imageUrl": "",
        "status": "",
        "statusState": "<''/none/information/error/success/warning>",
        "description": "",
        "buttons": [
          {
            "title": "{{this.item_list.item}}",
            "value": "{{this.item_list.item}}",
            "type": "postback"
          }
        ]
      }{{/eachJoin}}
    ]
  }
}

Step 3: In another skill, set memory field where the user input is stored and set another memory "item_list" to match the user input within the array value to remove it from the item_list. For this, I have entered the following script. But there is some problem with that script. How can I remove the item from the array?

{{#inArray memory.item_list.title memory.user_input.raw}}  "{{remove memory.item_list memory.user_input.raw}}" {{else}} "{{memory.lists}}"{{/inArray}}
Shihab
  • 13
  • 3

0 Answers0