Skip to content

Amazon Lex V2 NextStep Issue

0

I am creating an Amazon Lex V2 bot using CloudFormation. In two separate instances where the documentation states that I can define a NextStep:

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lex-bot-initialresponsesetting.html (NextStep) https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lex-bot-slotcapturesetting.html (CaptureNextStep)

This is one example of a NextStep definition in CloudFormation that is causing an error:

        - Name: MainMenuIntent
          Description: Provides the caller an option to give another input
          InitialResponseSetting:
            InitialResponse:
              MessageGroupsList:
                - Message:
                    PlainTextMessage:
                      Value: Sure, Please tell us the reason for your call.
            NextStep:
              DialogAction: 
                Type: FulfillIntent

The cf-linter accepts it just fine but when I build the LexBot, I receive the following error:

'FulfillIntent' next step at 'InitialResponse' in intent 'MainMenuIntent' points to a step which is inactive. Mark the step as active or change the next step and try your request again.

How would I define a next step in conversation through CloudFormation?

1 Answer
0

The issue you're facing is likely due to a limitation in AWS CloudFormation when defining NextStep or CaptureNextStep properties for an Amazon Lex V2 bot. Currently, CloudFormation does not support directly referencing the target step or intent within the same template.

To work around this limitation, you can create a separate CloudFormation resource for the target step or intent, and then reference its ARN (Amazon Resource Name) in the NextStep or CaptureNextStep property.

Here's an example of how you could define the NextStep in your CloudFormation template:

  1. Create a separate resource for the target intent:
MyTargetIntent:
  Type: AWS::LexV2Bot::Intent
  Properties:
    BotId: !Ref MyLexBot
    IntentName: MyTargetIntent
    # Define your target intent properties here
  1. In your MainMenuIntent, reference the ARN of the MyTargetIntent resource in the NextStep:
MainMenuIntent:
  Type: AWS::LexV2Bot::Intent
  Properties:
    BotId: !Ref MyLexBot
    IntentName: MainMenuIntent
    Description: Provides the caller an option to give another input
    InitialResponseSetting:
      InitialResponse:
        MessageGroupsList:
          - Message:
              PlainTextMessage:
                Value: Sure, Please tell us the reason for your call.
      NextStep:
        DialogAction:
          Type: Intent
          IntentQualifier: !GetAtt MyTargetIntent.IntentSignature

Replace MyTargetIntent with the appropriate resource name for your target intent, and MyLexBot with the resource name of your Lex bot.

Note that this approach may require some restructuring of your CloudFormation template, but it should resolve the issue you're facing with the NextStep definition.

EXPERT
answered 2 years ago
  • Unfortunately, CloudFormation does not recognize AWS::LexV2Bot::Intent, I receive the following:

    Error: updating CloudFormation Stack (arn:aws:cloudformation:us-east-1:783234655443:stack/FooV2Stack/fc535d10-49fd-11ef-8b3c-12711791d549): operation error CloudFormation: UpdateStack, https response error StatusCode: 400, RequestID: c7ade239-ed88-4338-a52e-261df820f7bd, api error ValidationError: Template format error: Unrecognized resource types: [AWS::LexV2Bot::Intent] │

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.