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 查看次数
没有答案

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则