2
votes

I'm trying to build a bot to change userinfo stored in a database.

My first thought was to create two slot types like {toChange} and {newValue} where the user could say "Change my name to Peter Griffin" or "My new email is [email protected]".

Turns out Lex can't handle these custom string inputs. I had to create a slot type for each value the user can have: {name} with AMAZON.Person, {address} with AMAZON.PostalAddress and so on and let Lambda handle the correct slots to elicit.

The problem is that Lex does not offer slot types for email or an bankingaccount number in IBAN format (nor any other format).

If I use a custom slot type with an empty enumeration list I can only enter text, not numbers. Furthermore blanks and special characterls like . and @ are not recognized and Lex asks for input again.

Is there any way to accomplish this? I thought of something like asking for the first part of the mail before the @, then to ask for the provider and lastly filling in the country code. But that is far far away from being userfriendly.

[EDIT]

During testing I found out there is no validation on Amazons side for AMAZON.PostalAddress as for now. I can literally type anything I want and it will be accepted, like lets say an email address or an account number :twinkle:

For the moment this approach works fine, but there is absolutely no guarantee it will stay this way in the future, so my question still is open.

PS: Like this I was able to follow my first approach with {toChange} and {newValue}, where the first is a custom slot type with enumation values und the latter is a AMAZON.PostalAddress slot.

1
i tried to use AMAZON.PostalAddress but seems they have applied some validation, now it's not taking ANY string. :(sid8491

1 Answers

0
votes

The way I did it was,
create a custom slot type like

{   "name": "emailAddressSlotType",
    "description": "see name",
    "enumerationValues": [
        { "value": "[email protected]" },
        { "value": "[email protected]" },
        { "value": "[email protected]" }
    ]
}      

The enumeration values are just sample email addresses. You then need to validate it with something like a Lambda validationCodeHook.
see: this probably... i'm still working on mine