Options List

The Options list data type behaves similar to the String list. However, the only difference in the options list is that it has an ID for each value. Using this, a text (value) can be shown to the visitor. Whenever they select one, the respective ID can be mapped to do further actions.

Note: The Options list is available only on the Output parameter.

Example: Displaying visitors' "Open" support tickets. 

  • Using the plugs, you can fetch open tickets from the Desk by visitor's email as plug input and store the ticket id and name as output (Options list).
  • By dynamic suggestion, you can display the tickets to the visitor. 
  • To show more details about a particular ticket, when a visitor clicks on it, you can save the response in the bot context and provide it as input to create another plug for displaying the ticket details. 
  • Here, when a visitor clicks on a specific ticket, the ticket ID will be given as plug input to execute another plug responsible for fetching that respective ticket details. 

The value for this input datatype will be available in the session object in the following format:

Attribute NameDatatype Description
metamap Options List Meta (A)
valueString (id)

The ID of the value

Ex: "948298438", "823489724","239827423"

String (text)

The String list has to be set here.

Ex: "Desk ticket 1", "Desk ticket 2","Desk ticket 3"

Options List Meta (A)

Attribute NameDatatype Description
typeStringValue should be 'optionlist'
valueString (id)

The ID of the value

Ex: "948298438", "823489724","239827423"

String (text)

The String list has to be set here.

Ex: "Desk ticket 1", "Desk ticket 2","Desk ticket 3"

​Note: If the static options are chosen together with dynamic options from the option list, a random id will be generated and allocated to the static options.

Sample Code:

Copied{
  "options": {
    "value": [
      {
        "text": "Desk ticket 1",
        "id": "948298438"
      },
      {
        "text": "Desk ticket 2",
        "id": "823489724"
      },
      {
        "text": "Desk ticket 3",
        "id": "239827423"
      }
    ],
    "meta": {
      "type": "optionlist",
      "value": [
        {
          "text": "Desk ticket 1",
          "id": "9482984398"
        },
        {
          "text": "Desk ticket 2",
          "id": "8234897294"
        },
        {
          "text": "Desk ticket 3",
          "id": "2398274283"
        }
      ]
    }
  }
}

Plug Script

CopiedoptionList = List();
optionList.add({"id":"ticket1","text":"Desk ticket 1"});
optionList.add({"id":"ticket2","text":"Desk ticket 2"});
optionList.add({"id":"ticket3","text":"Desk ticket 3"});
response = Map();
response.put("options",optionList);
return response;