Integrating an AWS Lambda function into your bot - Amazon Lex

Integrating an AWS Lambda function into your bot

With AWS Lambda functions, you can extend and 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. Before you begin, determine which fields in the input event you want to draw information from and which fields in the response you want to manipulate and return from your Lambda function

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

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

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

  3. Deploy the Lambda function.

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

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

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