Cliq Bots - Create preset actions for your bot using the menu handler

Cliq Bots - Create preset actions for your bot using the menu handler

Menu Handler provides an easy way to trigger actions with just one click! Imagine a news bot having the list of categories as a menu, instead of asking the bot to get the news for a particular category, the user can click on any particular menu action and get the details. For example, a custom menu action 'Help' dedicated to educating the users about the bot's functionality and how to interact with the bot will provide to be of great use!

Working of the bot menu handler

The workflow for the menu handler is pretty straightforward. The handler is invoked to perform an action when a user selects a particular action from the menu list. The response is displayed to the user as a preview. Take a look at the list of attributes passed when the menu handler is triggered in our help page

Note:  Each bot can have a list of 5 custom actions!

Sample Scenario

Let us try creating a feedback menu action for a bot. On clicking this feedback action, the user should be able to send feedback or feature requests to the bot creator directly. This makes it easier for the user to give their feedback without going through the usual route of sending an email / filling a form! 

The following steps go into creating this feedback menu :
  • Configure the feedback menu action to post message on click
  • A function to work in association with the feedback button. 
  • Creating a connection with Cliq ( to post the feedback response from the user to the bot creator) 
Take a look at the sample code snippet for the bot menu handler: 

  1. response = Map();
  2. response =
  3. {  
  4.    "text": "Hi " + user.get("first_name") + " !Tell us what you think of Connect Bot and also give us suggestions on a feature you would love to have! :grinning:",
  5. "card":{  
  6.       "title":"Feedback Time",
  7.       "theme":"prompt"
  8.    },
  9.    "buttons":{  
  10.       {  
  11.          "label":"Give Feedback",
  12.          "type":"+",
  13.          "action":{  
  14.             "type":"invoke.function",
  15.             "data":{  
  16.                "name":"feedback",
  17.                "owner": " youremail@yourdomain.com "
  18.             },
  19.             "confirm":{  
  20.                "title":"Give us your valuable feedback!",
  21.                "description":"Write what you think of Connect Bot!",
  22.                "buttontext":"Submit Feedback",
  23.                "input":"Enter your feedback here"
  24.             }
  25.          }
  26.       }
  27.    }
  28. };
  29. return response;
Sample Functions Execution Code:

  1. response = Map();
  2. feedback = arguments.get("input");
  3. param = Map();
  4. param.put("text","You've got a new feedback! User:" + user.get("email") + " Feedback: " + feedback);
  5. response = invokeurl
  6. [
  7. url :"https://cliq.zoho.com/api/v2/channelsbyname/feedbackchannel/message"
  8. type :POST
  9. parameters:param.toString()
  10. connection: " your connection name "
  11. ];
  12. message = Map();
  13. message = {"text":"Thank you for your feedback! :smile: ","bot":{"name":"Connect Bot"}};
  14. info message;
  15. post_message= zoho.cliq.postToChat(chat.get("id"),message);
  16. return Map();

The below-given video demonstrates how to configure and build this custom feedback menu action and also the working

 

We hope this sample scenario threw light on how easy bot actions are to create and equally easy to use! Comments and suggestions are welcome!

Few useful links to refer: 




Best,
Manasa
Cliq

    • Sticky Posts

    • Customer payment alerts in Zoho Cliq

      For businesses that depend on cash flow, payment updates are essential for operational decision-making and go beyond simple accounting entries. The sales team needs to be notified when invoices are cleared so that upcoming orders can be released. In contrast,
    • 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
    • Accelerate Github code reviews with Zoho Cliq Platform's link handlers

      Code reviews are critical, and they can get buried in conversations or lost when using multiple tools. With the Cliq Platform's link handlers, let's transform shared Github pull request links into interactive, real-time code reviews on channels. Share
    • App Spotlight : PagerDuty for Zoho Cliq

      App Spotlight brings you hand-picked apps to enhance the power of your Zoho apps and tools. Visit the Zoho Marketplace to explore all of our apps, integrations, and extensions. In today's fast-paced world, seizing every moment is essential for operational
    • Automate your status with Cliq Schedulers

      Imagine enjoying your favorite homemade meal during a peaceful lunch break, when suddenly there's a PING! A notification pops up and ruins your moment of zen. Even worse, you might be in a vital product development sprint, only to be derailed by a "quick