Cards & Functions: An inside view into how Cliq's custom buttons work!

Cards & Functions: An inside view into how Cliq's custom buttons work!

Message cards are simple templates which can be used to customise messages. In other words, responses on triggering an integration component (commands/ bots/ message actions) can be customised as a message easily with the templates. A message card can be styled with a title, image, buttons, table and so on! Adding a button helps in making the message more interactive and also provides a call to action. 

So where does a function fit here? 

A button can be triggered to perform an action on click, only when a function is associated with it. A function is a piece of code invoked when a button action is performed. The list of attributes triggered when a function is invoked, is explained in our functions handler help page. 

Sample use case scenario: Triggering functions on /issues command execution

Tracking issues is a great way to record bugs reported in a module of a product. The /issues command for instance will get a list of issues reported under the user's name. Each issue will have a button, on clicking which more information about the issue will be displayed. 

Pro Tip: Cliq offers a variety of message cards. Check them out here . You can also try building one using our message builder

/issues command workflow 

When a user executes the /issues command, the below given workflow is triggered
  1. Command suggestion handler is triggered and shows the user a list of portals
  2. Upon selection, the suggestion handler is triggered again to show a list of projects for the user to choose from
  3. Once the portal and project is selected, the command execution handler is invoked to get the list of issues for which the user is responsible for!
  4. Clicking on a button associated with each issue will get more details about the issue and display it as a separate card for the user to see. 
Watch this tutorial video on what functions are and how the /issues command execution and response works



Sample Functions Execution Code 

  1. response = Map();
  2. if(target.get("name") == ":bug: Info")
  3. {
  4. apiid = arguments.get("key").toList("-");
  5. portal = apiid.get(0);
  6. project = apiid.get(1);
  7. ID = apiid.get(2);
  8. bugdetails = invokeurl
  9. [
  10. url :"https://projects.zoho.com/restapi/portal/" + portal + "/projects/" + project + "/bugs/" + ID + "/"
  11. type :GET
  12. connection:" insert_your_connection_name "
  13. ];
  14. response = {"text":"Details about " + bugdetails.get("bugs").toMap().get("title"),"card":{"theme":"modern-inline"},"slides":{{"type":"label","data":{{"Reported By":bugdetails.get("bugs").toMap().get("reported_person")},{"Issue Status":bugdetails.get("bugs").toMap().get("status").toMap().get("type")}}}}};
  15. info response;
  16. }
  17. else if(target.get("name") == "All Open Issues")
  18. {
  19. info arguments;
  20. apiid = arguments.get("key").toList("-");
  21. portal = apiid.get(0);
  22. project = apiid.get(1);
  23. bugdetails = invokeurl
  24. [
  25. url :"https://projects.zoho.com/restapi/portal/" + portal + "/projects/" + project + "/bugs/?statustype=open"
  26. type :GET
  27. connection:" insert_your_connection_name "
  28. ];
  29. info bugdetails;
  30. bugs = bugdetails.toMap().get("bugs");
  31. info bugs.size();
  32. if(bugs.size() > 0)
  33. {
  34. rows = List();
  35. for each  bug in bugs
  36. {
  37. row = Map();
  38. info bug;
  39. row.put("Issue ID",bug.get("key"));
  40. row.put("Assigned To",bug.get("assignee_name"));
  41. row.put("Severity",bug.get("severity").toMap().get("type"));
  42. row.put("Issue Status",bug.get("status").toMap().get("type"));
  43. if(rows.size() <= 5)
  44. {
  45. rows.add(row);
  46. }
  47. }
  48. response = {"text":"Hey " + user.get("first_name") + " !  Recently reported issues!","card":{"theme":"modern-inline","title":"Issue List:"},"slides":{{"type":"table","title":"hello","data":{"headers":{"Issue ID","Assigned To","Severity","Issue Status"},"rows":rows}}}};
  49. }
  50. else
  51. {
  52. response = {"text":"Good news. Looks like there are no open issues in this project! :grinning:"};
  53. }
  54. }
  55. return response;

The /issues command execution and suggestion code is attached as a text file. Hope this has intrigued you to try it out right away.  Comments and suggestions are welcome! 

Best,
Manasa
Cliq

    Access your files securely from anywhere







                            Zoho Developer Community





                                                  Use cases

                                                  Make the most of Zoho Desk with the use cases.

                                                   
                                                    

                                                  eBooks

                                                  Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho Desk.

                                                   
                                                    

                                                  Videos

                                                  Watch comprehensive videos on features and other important topics that will help you master Zoho Desk.

                                                   
                                                    

                                                  Webinar

                                                  Sign up for our webinars and learn the Zoho Desk basics, from customization to automation and more

                                                   
                                                    
                                                  • Desk Community Learning Series


                                                  • Meetups


                                                  • Ask the Experts


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner




                                                            • 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
                                                            • 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
                                                            • Bulk user onboarding for Cliq Channels in a jiffy

                                                              As developers, we frequently switch between coding, debugging, and optimizing tasks. The last thing we want is to be burdened by manual user management. Adding users one by one to a channel is tedious and prone to errors, taking up more time than we could


                                                            Manage your brands on social media



                                                                  Zoho TeamInbox 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


                                                                                                      ご検討中の方