how can i disable amazon lex error handling?

375 Views Asked by At

I am interested in knowing how I can disable the handling error that is enabled by default when the user writes a word that amazon lex does not recognize, I leave an image of the handling error.

Thanks !!

1

1

There are 1 best solutions below

0
On

If Lex cannot determine an input's intent, then it will error, not send anything to your Lambda, and return your Error Handling message directly to the output channel directly to the user.

To customize or catch Lex's error handling beyond the options available in the Lex console settings, you would have to build your own relay or proxy between the user and Lex.

You would have to build the input and output formatting yourself going both ways. For example, an incoming Facebook Messenger JSON format would have to be parsed and reformatted and sent to Lex through PostText or PostContent. This allows you to also store exactly what the user input and compare that with the Lex interpretation after Lex passes to your Lambda.

Then as Lex returns a response (including Error Handling), your proxy would be able to catch it and parse this response, reformat it manually into a facebook JSON format, and deliver it to the user. Or in the case of an Error Handling message, your proxy could alter the response to pass your custom image.

The proxy also has the benefit of being able to format a Lex response into all of the channel's options. For example, having much more specific control over Facebook Messenger's interactive buttons, cards, images, links, etc.