Enabling custom logic with AWS Lambda functions - Amazon Lex

Enabling custom logic with AWS Lambda functions

With AWS Lambda functions, you can better control the behavior of your Amazon Lex V2 bot through custom functions that you define.

Amazon Lex V2 uses one Lambda function per bot alias per language instead of one Lambda function for each intent.

To integrate a Lambda function with your Amazon Lex V2 bot, carry out the following steps:

  1. Determine which fields in the input event you want to draw information from to use in your Lambda function.

  2. Determine which fields in the response you want to manipulate and return from your Lambda function.

  3. Create a function in AWS Lambda using your programming language of choice and write up your script.

  4. Make sure that the function returns a structure matching the response format.

  5. Deploy the Lambda function.

  6. Associate the Lambda function with a Amazon Lex V2 bot alias with the console or API operations.

  7. Select the conversation stages at which you want to invoke your Lambda function with the console or API operations.

  8. Build your Amazon Lex V2 bot and test that the Lambda function works as intended. Debug your function with the help of Amazon CloudWatch.