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
질문됨 2년 전137회 조회
답변 없음

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠