Cliq Bots - Building conversational bots with a series of questions and user inputs!

Cliq Bots - Building conversational bots with a series of questions and user inputs!

We all know how important it is for a bot to manage the conversation flow with a user. And so, here we bring to you the bot context handler! This post introduces the concept of a context and how a chain of questions and user inputs can be achieved through the context. 

Simply put, the context allows the bot to ask a series of questions pertaining to a topic of interest. The responses or the user inputs are then collected to perform an action at the end via the context handler.  Sounds interesting? Let's jump straight into the working of the bot's context handler!
 
So how does the bot context handler work?

The bot context handler is designed to handle multiple questions and collect the user responses. That is, a 'context' map has to be defined with the list of questions and their expected responses (as bot suggestions) from the user. This way your bot can easily ask questions to the user and collect all the information required for performing an intended action. The nitty-gritty of this handler is explained on our help page      

Key points about the context handler:

  • The context handler allows the bot to build and maintain a conversational flow, more like a dialogue exchange with a series of questions. 
  • This will be triggered only upon the initiation of the context map. 
  • Other bot handlers will be triggered to execute only if there is no ongoing context.
  • Also, an added advantage of using this handler is, your bot can handle multiple conversation chains smoothly unlike other handlers! 

So the context handler for the win!

Get started with a sample use case...

Let's say you are planning on creating a Quiz Bot for your team. A quiz bot that can engage the user by asking questions from a list of topics as suggestions. Once the user selects a topic, the bot will get started with the questions. Once the user answers a question, the answer will be saved followed by initiation of the next question. Take a look at how the context handler can be used in this scenario!

The sample context handler code is given below : 

  1. response = Map();
  2. if(context_id.matches("QUIZ"))
  3. {
  4. categories = {"Movies":11,"Politics":24,"Sports":21};
  5. if(categories.containKey(answers.get("quiz").get("text")))
  6. {
  7. topic = categories.get(answers.get("quiz").get("text"));
  8. }
  9. urlresponse = getUrl("https://opentdb.com/api.php?amount=5&category=" + topic + "&type=multiple");
  10. questions = urlresponse.get("results");
  11. info questions;
  12. randomNumbers = (getUrl("https://www.random.org/integers/?num=5&min=0&max=3&col=20&base=10&format=plain&rnd=new")).toList("\t");
  13. info randomNumbers;
  14. questionList = list();
  15. options = {0,1,2,3};
  16. count = 0;
  17. for each  question in questions
  18. {
  19. suggList = list();
  20. randomNumber = randomNumbers.get(count);
  21. info randomNumber;
  22. optionIter = 0;
  23. for each  opt in options.toList()
  24. {
  25. if(opt == randomNumber)
  26. {
  27. suggList.add({"text":question.get("correct_answer")});
  28. }
  29. else
  30. {
  31. suggList.add({"text":question.get("incorrect_answers").get(optionIter)});
  32. optionIter = optionIter + 1;
  33. }
  34. }
  35. questionString = question.get("question");
  36. questionString = questionString.replaceAll(""","'").replaceAll("'","'");
  37. q = {"name":"q" + count,"question":questionString,"suggestions":{"list":suggList}};
  38. questionList.add(q);
  39. questionList.add({"name":"a" + count,"question":questionString,"value":{"text":question.get("correct_answer")}});
  40. count = count + 1;
  41. }
  42. return {"text":"All the best for the quiz!  :victory:","context":{"id":"QuizChallenge","timeout":"600","params":questionList}};
  43. }
  44. else if(context_id.equalsIgnoreCase("QuizChallenge"))
  45. {
  46. marks = 0;
  47. q = {0,1,2,3,4};
  48. str = "";
  49. for each  no in q.toList()
  50. {
  51. qno = no + 1;
  52. userAns = answers.get("q" + no);
  53. origAns = answers.get("a" + no);
  54. if(userAns.equalsIgnoreCase(origAns))
  55. {
  56. str = str + qno + ". " + origAns.get("text") + "\n";
  57. marks = marks + 1;
  58. }
  59. else
  60. {
  61. str = str + qno + ". " + origAns.get("text") + "\n";
  62. }
  63. }
  64. str = str + "Score : " + marks + " / 5\n";
  65. quotes = {"5":"You're awesome!","4":"Great","3":"Good!","2":"Ok!","1":"Try again!","0":"Better luck next time!"};
  66. str = str + quotes.get("" + marks);
  67. return {"text":str};
  68. }
  69. return response;

Here's the message handler code :

  1. response = Map();
  2. if(message.containsIgnoreCase("Quotes"))
  3. {
  4. url = getUrl("https://talaikis.com/api/quotes/random/");
  5. quote = url.toMap();
  6. response = {"text":quote.get("quote"),"card":{"theme":"prompt","title":"Here's a quote for you by " + quote.get("author") + " :smile!:"}};
  7. }
  8. else if(message.containsIgnoreCase("Quiz"))
  9. {
  10. context = {"id":"QUIZ","timeout":"300","params":{{"name":"quiz","question":"Well, let us get started by choosing the category! Shall we? :grinning:","suggestions":{"list":{{"text":"Movies"},{"text":"Politics"},{"text":"Sports"}}}}}};
  11. response.put("context",context);
  12. }
  13. else
  14. {
  15. response = {"text":"Hi! I am Cupcake, your not so human friend. My motto in life is to stay happy always and I try to make everyone else happy too! :happy!: By just being myself. I am super cute. Just try asking me something, will you?","suggestions":{"list":{{"text":"Motivational Quotes"},{"text":"Quiz"}}}};
  16. }
  17. return response;

Check out this video for the working of the above given example!


We hope the context handler gave you an idea of how easily bot conversations can be framed! Let us know how this post helped you in the comments. 

 

Best,

Manasa

Cliq

    Access your files securely from anywhere


            Zoho Developer Community




                                      Zoho Desk Resources

                                      • Desk Community Learning Series


                                      • Digest


                                      • Functions


                                      • Meetups


                                      • Kbase


                                      • Resources


                                      • Glossary


                                      • Desk Marketplace


                                      • MVP Corner


                                      • Word of the Day



                                          Zoho Marketing Automation
                                                  • Sticky Posts

                                                  • Automating Employee Birthday Notifications in Zoho Cliq

                                                    Have you ever missed a birthday and felt like the office Grinch? Fear not, the Cliq Developer Platform has got your back! With Zoho Cliq's Schedulers, you can be the office party-cipant who never forgets a single cake, balloon, or awkward rendition of
                                                  • Convert a message on Cliq into a task on Zoho Connect

                                                    Message actions in Cliq are a great way to transform messages in a conversation into actionable work items. In this post, we'll see how to build a custom message action that'll let you add a message as a task to board on Zoho Connect. If you haven't created
                                                  • Cliq Bots - Post message to a bot using the command line!

                                                    If you had read our post on how to post a message to a channel in a simple one-line command, then this sure is a piece of cake for you guys! For those of you, who are reading this for the first time, don't worry! Just read on. This post is all about how
                                                  • Cliq Bots - How to make a bot respond to your messages?

                                                    Bots are just like your buddies with whom you can interact. They carry out your tasks, keep you notified about your to-dos and come in handy when you need constant updates from a third party application.  So, how can you make your bot respond to a message? The bot message handler is a piece of code triggered when a message is sent to the bot. Message handlers help you customise your bot responses to make it look conversational. The message input from the user can be either a string or an option selected
                                                  • Cliq Bots - Get notifications about any action on an application with the incoming webhook handler!

                                                    Webhooks can be used to get notified about events happening in other applications inside Cliq. All bots in Cliq have their own incoming webhook endpoint. This makes it simple to post messages to the bot from external applications. Unlike the send message


                                                  Manage your brands on social media



                                                        Zoho TeamInbox Resources

                                                          Zoho DataPrep Resources



                                                            Zoho CRM Plus Resources

                                                              Zoho Books Resources


                                                                Zoho Subscriptions Resources

                                                                  Zoho Projects Resources


                                                                    Zoho Sprints Resources


                                                                      Qntrl Resources


                                                                        Zoho Creator Resources



                                                                            Zoho CRM Resources

                                                                            • CRM Community Learning Series

                                                                              CRM Community Learning Series


                                                                            • Kaizen

                                                                              Kaizen

                                                                            • Functions

                                                                              Functions

                                                                            • Meetups

                                                                              Meetups

                                                                            • Kbase

                                                                              Kbase

                                                                            • Resources

                                                                              Resources

                                                                            • Digest

                                                                              Digest

                                                                            • CRM Marketplace

                                                                              CRM Marketplace

                                                                            • MVP Corner

                                                                              MVP Corner





                                                                                Design. Discuss. Deliver.

                                                                                Create visually engaging stories with Zoho Show.

                                                                                Get Started Now


                                                                                  Zoho Show Resources


                                                                                    Zoho Writer Writer

                                                                                    Get Started. Write Away!

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

                                                                                      Zoho CRM コンテンツ






                                                                                        Nederlandse Hulpbronnen


                                                                                            ご検討中の方





                                                                                                  • Recent Topics

                                                                                                  • Where is the customization and extendibility of zoho inventory?

                                                                                                    After delving into zoho one subscription to test out systems we need for our business, I'm really disappointed after working in Zoho Inventory. Its features and customizability are extremely lacking compared to the other tools like CRM. In our case we
                                                                                                  • Deleted message in SPAM

                                                                                                    In one of my gmail accounts (getnickifit@gmail.com) I had an email from PayPal in the SPAM folder. I thought I was moving the message to the inbox from the zoho mobile but it looks like it was deleted. It is no where to be found--inbox, trash, etc. Can it be restored?
                                                                                                  • "notes"-field in a task to full width?

                                                                                                    Hi, Is there someone that can tell me how to adjust the "notes"-field in a task, to full width? I already played around with 1 or 2 columns, but this has nu effect on the standard width. Thx in advance for your help. Cheers, Ralph.
                                                                                                  • Search function not working anymore

                                                                                                    Hi! The search function is not working anymore. How can we solve this problem?
                                                                                                  • How to download Job Sheets in Zoho FSM?

                                                                                                    Hello, I'd like to download copies of completed job sheets as PDF's for upload to a workdrive to keep an audit record of completed Job checkout sheets. I do not see download of this file type as an option - any help is appreciated!
                                                                                                  • Custom service report or Zoho forms integration

                                                                                                    Hello, So far the experience with Zoho FSM and the integration with Books has been good, however there are limitations with service reports. As with my business, many organisations send technicians to different types of jobs that call for a different
                                                                                                  • JOB Sheet can not send PDF as service rapports and more info needed other topic

                                                                                                    Goedendag, - Jullie hebben nu job sheet erin gedaan en dar is echt super goed, enkel kunnen we de werkbon ( JOB sheet) nu niet verzenden als PDF als een service rapport naar onze hoofdaannemer hoe we dat nu doen als bewijs van de levering van het werk
                                                                                                  • Dialing Microsoft Teams Phone Service via Zoho CRM

                                                                                                    I am using the VOIP option in Microsoft teams for my office phone system. I was hoping to have a way to dial numbers directly from Zoho CRM, but don't see anything in the Teams Integration or in the Telephony integration that will enable this. Does anyone
                                                                                                  • [Webinar] Zoho Writer for law firms and legal professionals

                                                                                                    Are manual processes slowing down your legal practice? Are you ready to simplify document management and free up more time for your team to focus on what truly matters? Join us on January 16, 2025, for an exclusive Zoho Writer webinar designed specifically
                                                                                                  • Introducing Bin Locations In Zoho Inventory

                                                                                                    Hello users, We are excited to let you know that your wait for the Bin Locations feature has now come to an end! Yes, you heard us right! We are here to introduce the much-awaited Bin Locations now in Zoho Inventory. But before we dive into the feature
                                                                                                  • How to send mail with js SDK

                                                                                                    Hell o I'm using https://live.zwidgets.com/js-sdk/1.2/ZohoEmbededAppSDK.min.js, for my widget in CRM (built with sigma) Is it possible to send email from js file, I try ti use that ZOHO.CRM.API.sendMail({ "Entity": "Accounts", "RecordID": sharedVariableEntityId,
                                                                                                  • Cannot add Zoho Forms link to LinkedIn

                                                                                                    Hello, We have encountered a problem where we are unable to share a Zoho Forms link on LinkedIn. This is what we got from LinkedIN, but we have not heard back from Zoho Support as yet, and we are meanwhile stuck... "It seems the URL does not scrape the
                                                                                                  • In ZohoCRM Dashboards - Editing Shown Columns on Drilldown of Components

                                                                                                    Hello! I'm working with some Dashboards inside of ZohoCRM. When creating a component (In this case, specifically a KPI Ranking Component), I'd like to customize which fields show when trying to drilldown. For example, when I click on one of the sales
                                                                                                  • Feature request - pin or flag note

                                                                                                    Hi, It would be great if you could either pin or flag one or more notes so that they remain visible when there are a bunch of notes and some get hidden in the list. Sometimes you are looking for a particular name that gets lost in a bunch of less important
                                                                                                  • i keep see there is a connetion issue connecting 3rd party api on zoho when using zia

                                                                                                    hi there , i have set up open ai api to zoho zia (copied and pasted to zoho zia) but I keep getting notificaiton "there is a connetion issue connecting 3rd party api on zoho" when using zia on top when click zia and try to type in word there
                                                                                                  • Flow with CRM

                                                                                                    Hello, I have a simple flow that uses a web hook to enter data into a Sales Order. I have the web hook sending Flow data which has a PO field. If the PO has a special character like - or / or \ the task fails. How can I get the flow to be okay with the
                                                                                                  • SendMail in CRM Deluge function rejects a validated email address

                                                                                                    In a CRM Deluge function, the email address is considered invalid. Is there another method by which it can be validated? It's unacceptable in my current situation to use either the zoho.loginuserid or adminuserid as the From address.
                                                                                                  • how do i remove a specific Zoho Service from my account

                                                                                                    I no longer need Zoho CRM, ZRM Assist nor ZRM BugTracker. How do I remove them from the list of apps for my account?
                                                                                                  • Link project tasks to tasks in CRM and/or other modules.

                                                                                                    Hello, I have created and configured a project in Zoho Projects with a set of tasks. I would now like to link these tasks (I imagine according to the ID of each one) to actions in the CRM: meetings, tasks, analytics). The aim is to link project tasks
                                                                                                  • Introducing 'Queries' In Zoho CRM

                                                                                                    Hello everyone! We are here with an exciting feature - Queries in Zoho CRM! A little context before we dive right into the feature specifics :) In today’s fast-paced business environment, immediate access to relevant data is essential for informed decision-making.
                                                                                                  • How to map a global picklist from one module to another

                                                                                                    Hi there, i currently have a new field that is called sales office which we use for permission settings between our different offices located in different countries. It is a global set picklist with three different options: MY, SG and VN. I want to be
                                                                                                  • Build custom AI solutions with Catalyst’s QuickML capabilities in CRM

                                                                                                    Hello everyone, We’re thrilled to announce an improvement for our Zoho CRM Enterprise users: the ability to create custom AI solutions using Catalyst’s QuickML directly from Zoho CRM. As you may already know, Zia, Zoho CRM’s AI-powered assistant, offers
                                                                                                  • Unveiling Cadences: Redefining CRM interactions with automated sequential follow-ups

                                                                                                    Last modified on 01/04/2024: Cadences is now available for all Zoho CRM users in all data centres (DCs). Note that it was previously an early access feature, available only upon request, and was also known as Cadences Studio. As of April 1, 2024, it's
                                                                                                  • Pay Contractor Timesheets

                                                                                                    I have contractors that fill out a timesheet. Each hour must be assigned to a current client. I need the easiest way to get the contracts paid. They are paid on an hourly bases. How can this be done?
                                                                                                  • Inventory Valuation Method Feature

                                                                                                    Zoho added another feature so called Inventory Valuation Method of each Item. This is actually good to see and it will benefit us so much but I have a question on this. For Existing Items that already have transactions, Zoho made it a default and assumed
                                                                                                  • Set up slack alert based on a field changing from one option to any other

                                                                                                    Hi, I'm trying to set-up a workflow to send a slack alert if a field changes from one option to any other. I've set-up a workflow to trigger on Edit and when a specific field gets modified but the only option I have 'is modified to' when really it should
                                                                                                  • Better UI more user friendly

                                                                                                    Hello everyone, I think all finance apps, especially Zoho Books, would benefit from the following suggestions/ notes: 1. Grouping Fields in Zoho Books: Unlike Zoho CRM, Zoho Books does not seem to have an option to create sections or group fields. This
                                                                                                  • Chronicles of 2024: The Year in Retrospect

                                                                                                    As we close out 2024, let’s take a moment to highlight the new features and updates that have enhanced Zoho Invoice in 2024. Among the exciting enhancements, we have launched a new AI-powered chatbot designed to assist you in understanding the app's features
                                                                                                  • Power of Automation :: Automatically archive your inactive Projects

                                                                                                    Hello Everyone, A custom function is a software code that can be used to automate a process and this allows you to automate a notification, call a webhook, or perform logic immediately after a workflow rule is triggered. This feature helps to automate
                                                                                                  • 554 5.1.8 Email Outgoing Blocked

                                                                                                    HELP!!!!! My e-mail marymariya@zoho.com is blocked. Error: 554 5.1.8 Email Outgoing Blocked The third day I am writing to the forum, but zohosupport is not responding. Why? What is the problem? I ask to help solve the problem, because I can not communicate with my customer base.
                                                                                                  • Zoho Inventory: Rewinding 2024

                                                                                                  • Custom Modules Now available for Standard and Professional Editions with Expanded Limits across all editions

                                                                                                    #CRM25Q1 Hello Everyone, We are here with an exciting update to Custom Modules in Zoho CRM. Custom modules will now be available to Standard and Professional Edition users, with expanded support across all editions. The standard modules offered in Zoho
                                                                                                  • Assistance with Custom Attendance Report in Zoho People

                                                                                                    Hi, I created a custom report in Zoho People 5.0 to track employee attendance according to our specific needs, as the existing reports do not include all the required details. However, I’ve noticed that the report doesn’t update continuously or on a daily
                                                                                                  • Zoho analyticsでのタブを跨いだ集計

                                                                                                    Zoho analyticsまたはCRMレポートなどを用いて、 見込み客タブと商談タブで共通するユニークキー(リード管理番号)を軸に、「共通選択リスト」で設定した項目別の集計を行うことは可能でしょうか? ・要望 ①リード管理番号をキーに、見込み客テーブルと商談テーブルを結合したRAWデータを作成したい ②具体的には下記表のように「共通選択リスト」項目(サービス)別のマーケ数値を一表にしたい  ※リード=見込み客タブ 商談・成約=商談タブ      リード数 商談数 成約数 サービスA   10   5   2
                                                                                                  • Key Highlights of 2024: Recalling a Year of Progress and Advancements!

                                                                                                    As we step into 2025, we’re excited to share the progress and developments we’ve made to simplify and streamline your travel and expense management in the past year. Let’s take a look back at some of the key updates and enhancements that have helped us
                                                                                                  • How to refresh the page by widget in related list?

                                                                                                    Hello, ZOHO.CRM.UI.Popup.closeReload method does the thing I need. But in my case, I'm not using popup. I have a widget in related list and I want to refresh the page when I'm done with it. I searched for it but I wasn't able to find it. Is there an any
                                                                                                  • Organization Variables - Restrict Access

                                                                                                    Currently, there is no way to restrict the access to organization variables. This leads to a problem when storing API related values that should be kept secret as anyone with access to create and edit email templates, workflow rules, or inventory templates
                                                                                                  • your phone line in the uk doesnt work i need help now

                                                                                                    i need to speak with customer service urgently
                                                                                                  • Top Menu Disappeared from Blog Page

                                                                                                    Hi, Our top menu disappeared at Blog Posts page. However, it's still visible any other page on the website. I attached two screenshots, so it can be understood clearly. How can we bring back top menu? Thanks, K.
                                                                                                  • Missing phone numbers

                                                                                                    yesterday I have noticed that most contacts' phone numbers are missing. At first I thought it is a synchronisation problem with my Android phone but as I have found later, numbers are missing on Zoho. I have tried to reimport contacts from a backup but
                                                                                                  • Next Page