Enabling custom logic with AWS Lambda functions - Amazon Lex

Enabling custom logic with AWS Lambda functions

This section describes how to attach a Lambda function to a bot alias and the structure of the event data that Amazon Lex V2 provides to a Lambda function. Use this information to parse the input to your Lambda code. It also explains the format of the response that Amazon Lex V2 expects your Lambda function to return.

Amazon Lex V2 uses one Lambda function per bot alias per language instead of one Lambda function for each intent. To use an individual function for each intent, the Lambda function router section provides a function that you can use.

You can use Lambda functions at the following points in a conversation with a user:

  • Before the conversation starts. For example, after telling the user the recognized intent.

  • After eliciting a slot value from the user. For example, after the user tells the bot the size of pizza they want to order.

  • Between each retry for eliciting a slot. For example, if the customer doesn't use a recognized pizza size.

  • When confirming an intent. For example, when confirming a pizza order.

  • To fulfill an intent. For example, to place an order for a pizza.

  • After the intent has been fulfilled. For example, to switch to an intent to order a drink.