Amazon Lex - Send empty message prompt from AWS Lambda

0

Hello,

I'm using Amazon Lex V2, with the code hooks in AWS Lambda. In some particular cases, I'm trying not to send any message back to the user after closing the dialog, but for some reason, the documentation (https://docs.aws.amazon.com/lexv2/latest/dg/lambda.html) doesn't seem to be in-line with what is happening in Lex (I'm receiving an error, find the error message in section Lambda response which doesn't work).

For a dialogAction of type Close with an intent of state Fulfilled, it requires me (otherwise I'm receiving an error) to fill in the messages part of the JSON response, even though the documentation mentions it is only necessary for an ElicitIntent dialog action. (See below section Lambda response which doesn't work)

Sending in a Delegate dialogAction and not adding any closing messages in the Lex intent (in the Lex Console) does work, but this seems like a hacky solution for something that should already work with the Close dialogAction. (See below section Lambda response which works if there is no closing message in Lex)

You may ask yourself why would I want that instead of sending in a default response message (e.g. "Please wait" or "One moment"), the reason is because Lex would be integrated in a 3rd party application, and there is some business logic with prompts already integrated there saying the same thing.

Am I missing something with the responses format in Lambda?

Lambda response which doesn't work:

Response:

{
    sessionState: {
        dialogAction: {
            type: "Close"
        },
        intent: {
            name: "TestIntent",
            slots: event.sessionState.intent.slots,
            state: "Fulfilled"
        }
     }
};

Error: Invalid Lambda Response: The Lambda code hook didn't contain a message. The intent is not configured with a follow up prompt, a conclusion statement, or a fulfillment success response.

Lambda response which works if there is no closing message in Lex:

Response:

{
    sessionState: {
        dialogAction: {
            type: "Delegate"
        }
    }
};

Result: No error, only the message text for which the intent was fulfilled (only in the Lex console chat), but it works fine in the 3rd party application.

Thank you,

John
asked 5 months ago64 views
No Answers

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.

Guidelines for Answering Questions