End conversation flow after Connecting lambda function to aws lex v2 chatbot

0

Hi! I am eager to build my own chatbot using aws lex v2 and aws lambda v1. I've succeeded to create intents, utterances, slots, fulfillment, closing response. I am able to create, update, delete the intent, slots whenever I want. The step where I am is attach the lambda function uploaded to the aws lambda console to aws lex v2 console. Actually, i did this by adding the lambda function when testing as I am curretly at the stage of draft version. When I build and test, everything goes well without any error. But, the problem is when the labmda function is executed, the next step which is closing response did not follow even though I set the closing response which works well when I did not attach the lambda to the aws lex v2.

[1] The conversation flow just stops after the labmda function's executed. [2] Furthermore, it did not show success or failure messages I've set in the fulfillment section. This also works well when I did not attach the lambda function.

I attach the code for the testing lambda function. If you need something more to determine the problem, please feel free to leave a comment. Thank you for your help!

  • [3] One more thing, my coworker told me it's impossible to make both the closing response and Lambda function work simultaneously. I also want to check if it is true. Thank you!

public class LambdaReservation implements RequestHandler<Object,Object>{

@Override
public Map<String, Object> handleRequest(Object input, Context context) {
    context.getLogger().log("Input: " + input);


    Map<String, Object> intent = new HashMap<>();
    intent.put("name", "Reservation");

    intent.put("state", "Fulfilled");
    intent.put("confirmationState", "None");


    Map<String, Object> message = new HashMap<>();
    message.put("contentType", "PlainText");
    message.put("content", "Hello from Lambda!");
    List<Map<String, Object>> messages = new ArrayList<>();
    messages.add(message);

    Map<String, Object> dialogAction = new HashMap<>();
    dialogAction.put("type", "Close");
    dialogAction.put("fulfillmentState", "Fulfilled");
    dialogAction.put("message", message);

    Map<String, Object> sessionState = new HashMap<>();
    sessionState.put("intent", intent);
    sessionState.put("sessionAttributes", new HashMap<>());
    sessionState.put("dialogAction",dialogAction);

    Map<String, Object> response = new HashMap<>();
    response.put("sessionState", sessionState);
    response.put("messages", messages);
    response.put("requestAttributes", new HashMap<>());

    return response;

}

}

frank
질문됨 9달 전104회 조회
답변 없음

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

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

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

관련 콘텐츠