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."});
}
}
    Zoho Desk Resources

    • Desk Community Learning Series


    • Digest


    • Functions


    • Meetups


    • Kbase


    • Resources


    • Glossary


    • Desk Marketplace


    • MVP Corner


    • Word of the Day


      Zoho CRM Plus Resources

        Zoho Books Resources


          Zoho Subscriptions Resources

            Zoho Projects Resources


              Zoho Sprints Resources


                Zoho Orchestly Resources


                  Zoho Creator Resources


                    Zoho WorkDrive Resources



                      Zoho Campaigns Resources

                        Zoho CRM Resources

                        • CRM Community Learning Series

                          CRM Community Learning Series


                        • Tips

                          Tips

                        • Functions

                          Functions

                        • Meetups

                          Meetups

                        • Kbase

                          Kbase

                        • Resources

                          Resources

                        • Digest

                          Digest

                        • CRM Marketplace

                          CRM Marketplace

                        • MVP Corner

                          MVP Corner




                          Zoho Writer Writer

                          Get Started. Write Away!

                          Writer is a powerful online word processor, designed for collaborative work.

                            Zoho CRM コンテンツ




                              ご検討中の方