How can I get Bot to respond based on Customer's Response ?

How can I get Bot to respond based on Customer's Response ?

I am trying to add a bot to my website where before ending the script I want to ask customer if he needs help with anything else. The input type options I am trigerring are YES & NO.

I want Zobot to End the chat if the answer is NO, else forward to the chat agent. It's not working, how to do it ?

This is the code I have in the context handler.

if(!answers.containsKey("morehelp"))
{
question = {"name":"morehelp","replies":{"Thanks for booking a meeting with us","I have forwarded your request to Sid and he will be reaching out to you shortly.","Is there anything else I can help you with?"},"input":{"type":"select","options":{"Yes","No"}}};
}
else
{
morehelp = answers.get("morehelp").get("text");
if(answers.containsKey("No"))
{
response.put("action","end");
response.put("replies",{"Bye"});
return response;
}
else
{
response.put("action","forward");
response.put("replies",{"I'm sorry for the inconvenience. Let me connect you to an agent."});
}
}