response = Map(); info answers; if(context_id.equals("endactionhandler")) { endaction = answers.get("endaction").get("text"); if(endaction.equalsIgnoreCase("No, I'm done")) { response.put("action","context"); response.put("context_id","rating"); _rating = {"name":"rating","replies":{"How was your conversation with the Bot?"},"input":{"type":"happiness-rating","level":"3"}}; response.put("questions",{_rating}); } else { response.put("action","reply"); response.put("replies",{"Please tell me your question"}); } } else if(context_id.equals("rating")) { response.put("action","end"); response.put("replies",{"Thank you. Have a great day :)"}); } return response;