I am getting few values from an API called within a service node. I want to see the options in a entity node based on the data that I get from the API.
How do I achieve this?
I tried to add a Entity with type List Enumerated and within the settings, used the option “List from Context” where I provided the value as context.ServiceNodeName.response.body as this variable gets the response back.
But when I run the bot, I am not able to get any choices back. I have also enabled “Yes, use channel specific standard formatting for default messages and show available list of values to end user.” but I do not get any values for selection to the user.
This is not working as you specified the same set of synonyms for every entry in the list.
Any display name or value you choose will stand ambiguous.
A synonym has to be carefully chosen so that there is no ambiguity with other options when you select the input.
cc: @andy.heydon For your expert guidance if needed.
For this situation it is assumed that the context variable to use, context.session.BotContext.SearchStockResponse is an array of objects where the display name, value and synonyms keys are properties of each object in that array.
Therefore from that definition, the platform would be looking for an array in context.session.BotContext
So you need to reorganize your JSON so that there is a specific, and single, synonyms property in each of the list’s objects and use that property name in the List of Items configuration. The synonyms value can be an array of strings where each string is a synonym or phrase. So I’m guessing something like:
BTW, synonyms do not have to be unique if you cater for ambiguity or define the entity as multi-item. Never expect users to be perfect in their language, they might be saying something to remind them and then will “refine/remember” from there.