Dynamic Suggestions
The dynamic suggestions in the Options and Multiple option block are used to provide suggestions/options dynamically using plugs to the visitors. For example, If a visitor wants to know their upcoming appointments, you can use plugs and fetch the upcoming appointments. Using dynamic suggestions, you can incorporate these appointments on the Option/Multiple options block.
Step 1 - Create a plug:
- Provide the required input parameters and select the datatype as String List or Option List for the output parameter.
- Then write the logic for the use-case/requirement and Publish it.
- In this example, this plug (Mybookings) will fetch the upcoming bookings of the visitor using their email.
Step 2 - Map the plug output to dynamic suggestion
- Provide a bot context to store the plug output.
- Next, select the plug output bot context on the dynamic suggestion present on the Options/Multiple options block.
- Static options can also be provided, along with dynamic suggestions.
Here, when the visitor selects "My upcoming appointments," the plug executes and provides the list of upcoming schedules as output. This output is mapped with the dynamic suggestions present in the Multiple Option card to display visitors' upcoming appointments.
Note: The dynamic suggestion values cannot be used as criteria in the Criteria Router block.
Syntax
Copiedresponse = Map();
options = List();
options.add("Suggestion1");
options.add("Suggestion2");
options.add("Suggestion3");
response.put("stringlist",options);
return response;
Plug Response
Copied{
"stringlist": {
"value": [
"Suggestion1",
"Suggestion2",
"Suggestion3"
],
"meta": {
"type": "stringlist",
"value": [
"Suggestion1",
"Suggestion2",
"Suggestion3"
]
}
}
}