Collect list in form

Hi! I’m trying to create a form where the user can provides many email-adresses as he/she want. However form’s don’t support slot with list-type so I’m not really sure how to tackle this. What is the best way to solve this?


I accidently noticed that if I have the same entity mentioned twice in an example, both values are sent to the same slot as a list. (This broke some of my actions that read the slots back!) I don’t know how to specify a variable number of entities, though.

One misconception about forms is that you need them to fill in slots. Actually, entity extraction and slot filling is done based on the training data. Forms are only needed when you have required slots that should be filled before proceeding.

That said, in a form you can have a required slot (say email_list…) that you can fill with whatever the user enters, using self.from_text(). (You can find an example here: Custom slot mappings.)

I’d ask the user for a list of comma or semi-colon separated emails, read the whole text and do the split myself in the validation script for the form/slot, using text.split(';') or something like that. I’ve never set a slot with a list, but if that doesn’t work, save it as the whole string and in the custom action split it again.

If the slot won’t be used to predict conversation flow, you should create it with type: unfeaturized.