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:
-
Create a function in AWS Lambda using your programming language of choice and write up your script.
-
Make sure that the function returns a structure matching the response format.
-
Deploy the Lambda function.
-
Associate the Lambda function with a Amazon Lex V2 bot alias with the console or API operations.
-
Select the conversation stages at which you want to invoke your Lambda function with the console or API operations.
-
Build your Amazon Lex V2 bot and test that the Lambda function works as intended. Debug your function with the help of Amazon CloudWatch.