Convert a message on Cliq into a task on Zoho Connect

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 a board in Zoho Connect, then head over to this help document to know how to create one. 

For this example, we've created a board for the Zylker Campaigns team in Zoho Connect. The board has three sections: User Interface, Content Marketing, Customer Support. We'll see how the marketing team discusses about upcoming marketing initiatives and keeps track of tasks in their connect board. 



The workflow behind creating this message action is pretty simple. 

1. Once a user clicks on the Add Connect Task message action, the action's handler is triggered to display a form. 
2. The user fills all the information required. We use the form change handler to modify the form field values based on the users' inputs. For example, display networks that the user is a part of by default and on selecting a specific network, we'll show the list boards that the user is a part of under the selected network. The same applies for sections as well. 
3. On choosing the respective network, board and section, the user can add the task title, description, due date, assignee and more. Note that, the message on which the action was performed will be displayed as the task title by default. This can be modified.
4. On clicking Add Task, the form submit handler is invoked to create a task in Connect with all the provided details. 

Prerequisites
Create a connection between Cliq and Connect: 
You'll need an active connection between Cliq and Connect. To create a connection, 
  1. Click on your display picture. This will open up the user panel. Now, click on Bots & Tools
  2. Click on the Connections icon present on the left side menu of the Bots & Tools page. 
  3. Now, click on Create Connection
  4. In the Add Connections view, select the Zoho Oauth option. 
  5. Name your connection. For example you can name your connection: zoho_connect or zohoconnect and choose the following scopes: zohopulse.networklist.READ, zohopulse.tasks.READ, zohopulse.tasks.CREATE
  6. Make sure the Use Credentials of Login User option is enabled. 
  7. Click on the Create and Connect button to generate the invoke URL task with the connection name. 
We'll be using this invoke URL task in our code. 

Create a message action 

To create a message action on Cliq, 

  1. Click on your display picture. This will open up the user panel. Now, click on Bots & Tools. 
  2. Click on Message Actions in the left pane.
  3. Click on the Create Message Action button and fill in the required details. 
    Action Name: Provide your message action name. This field is mandatory.
    Hint: Brief explanation about the message action.
    Access Level: Decide who gets to access your message action. Choose between Organization, Team and Private. Default option is Private.
    Choose what kind of messages should have the message action. Options are Text messages, Attachments and Links. For this example, we're choosing messages of the type Text
  4. Click on Save & Edit Code. 
Create a form function

To create a form function on Cliq, 

  1. Click on your display picture. This will open up the user panel. Now, click on Bots & Tools.
  2. Click on Functions in the left pane. Click on the Create Function button and fill in the required details. 
  • Name: Give your function name. Ensure to use the same function name in your form's code as well. 
  • Description: Briefly describe how your function works. 
  • Function Type: Choose the component with which the function should be associated. For this example, we're using the function of the type: Form 

Step 1: Configuring the message action handler
The message handler is triggered to return the Create Task form as a response. 

  1. messageText = message.get("content").get("text");
  2. getNetworks = invokeurl
  3. [
  4. url :"https://connect.zoho.com/pulse/api/allScopes"
  5. type :GET
  6. connection: "" // Give your connection name
  7. ];
  8. getNetworks = getNetworks.get("allScopes").get("scopes");
  9. netWorkOptions = List();
  10. for each  network in getNetworks
  11. {
  12. networkList = Map();
  13. networkList.put("label",network.get("name"));
  14. networkList.put("value",network.get("id"));
  15. netWorkOptions.add(networkList);
  16. }
  17. inputs = list();
  18. inputs.add({"type":"select","name":"networks","label":"Network","hint":"Select a network","placeholder":"Select a network!","mandatory":true,"value":"","options":netWorkOptions,"trigger_on_change":true});
  19. inputs.add({"type":"select","name":"boards","label":"Boards","hint":"Select a board","placeholder":"Select a board!","mandatory":true,"value":"","options":netWorkOptions,"disabled":"true","trigger_on_change":true});
  20. inputs.add({"type":"select","name":"sections","label":"Section","hint":"Select a section","placeholder":"Select a section!","mandatory":true,"value":"","options":netWorkOptions,"disabled":"true"});
  21. inputs.add({"name":"title","label":"Title","placeholder":messageText,"value":messageText,"hint":"Enter your task name","min_length":"0","max_length":"50","mandatory":true,"type":"text"});
  22. inputs.add({"type":"textarea","name":"note","label":"Description","hint":"Describe your task.","placeholder":"To be done by Tuesday","mandatory":false});
  23. inputs.add({"name":"duedate","label":"Due by","placeholder":"Give your task's due date.","mandatory":false,"type":"date"});
  24. inputs.add({"type":"select","name":"priority","label":"Priority","hint":"Choose your task priority","placeholder":"High","mandatory":true,"value":"High","options":{{"label":"No Priority","value":"None"},{"label":"Low","value":"Low"},{"label":"Medium","value":"Medium"},{"label":"High","value":"High"}}});
  25. addTask = {"name":"addTask","type":"form","title":"Add a task","hint":"Add a task to a board in Zoho Connect. ","button_label":"Add Task","inputs":inputs,"action":{"type":"invoke.function","name":"connectTask"}};
  26. return addTask;





Step 2: Configuring the form change handler

The form change handler will be triggered when the user is filling up the form. The handler is responsible for modifying the form field values based on the user's inputs. 

  1. targetName = target.get("name");
  2. inputValues = form.get("values");
  3. networkID = inputValues.get("networks").get("value");
  4. actions = list();
  5. if(targetName.containsIgnoreCase("networks"))
  6. {
  7. getBoards = invokeurl
  8. [
  9. url :"https://connect.zoho.com/pulse/api/myBoards"
  10. type :GET
  11. parameters:{"scopeID":networkID}
  12. connection:"" // Give your connection name
  13. ];
  14. getBoards = getBoards.get("myBoards").get("boards");
  15. boardOptions = List();
  16. for each  board in getBoards
  17. {
  18. boardList = Map();
  19. boardList.put("label",board.get("name"));
  20. boardList.put("value",board.get("id"));
  21. boardOptions.add(boardList);
  22. }
  23. actions.add({"type":"update","name":"boards","input":{"type":"select","name":"boards","label":"Boards","hint":"Select a board","placeholder":"Select a board!","mandatory":true,"options":boardOptions,"trigger_on_change":true}});
  24. }
  25. else if(targetName.containsIgnoreCase("boards"))
  26. {
  27. boardId = inputValues.get("boards").get("value");
  28. getResponse = invokeurl
  29. [
  30. url :"https://connect.zoho.com/pulse/api/boardSections"
  31. type :GET
  32. parameters:{"scopeID":networkID,"boardId":boardId}
  33. connection:"" // Give your connection name
  34. ];
  35. getSections = getResponse.get("boardSections").get("sections");
  36. sectionOptions = List();
  37. for each  section in getSections
  38. {
  39. sectionList = Map();
  40. sectionList.put("label",section.get("name"));
  41. sectionList.put("value",section.get("id").toString());
  42. sectionOptions.add(sectionList);
  43. }
  44. getMembers = getResponse.get("boardSections").get("members");
  45. if(getMembers.isempty() == false)
  46. {
  47. boardMembers = List();
  48. for each  member in getMembers
  49. {
  50. memberList = Map();
  51. memberList.put("label",member.get("name"));
  52. memberList.put("value",member.get("zuid"));
  53. boardMembers.add(memberList);
  54. }
  55. actions.add({"type":"update","name":"sections","input":{"type":"select","name":"sections","label":"Section","hint":"Select a section","placeholder":"Select a section!","mandatory":true,"options":sectionOptions}});
  56. actions.add({"type":"add_after","name":"duedate","input":{"type":"select","name":"members","multiple":true,"label":"Assignees","hint":"Add assignees","placeholder":"Assign task to a member","mandatory":false,"options":boardMembers}});
  57. }
  58. else
  59. {
  60. actions.add({"type":"update","name":"sections","input":{"type":"select","name":"sections","label":"Section","hint":"Select a section","placeholder":"Select a section!","mandatory":true,"options":sectionOptions}});
  61. }
  62. }
  63. return {"type":"form_modification","actions":actions};



Step 3: Configuring the form submit handler

We'll call the create task API in form submit handler. The submit handler typically receives all the inputs filled by the user and will be triggered on form submission. 

  1. response = Map();
  2. formValues = form.get("values");
  3. scopeID = formValues.get("networks").get("value");
  4. boardId = formValues.get("boards").get("value");
  5. sectionId = formValues.get("sections").get("value");
  6. title = formValues.get("title");
  7. priority_value = formValues.get("priority").get("value");
  8. parameters = {"scopeID":scopeID,"boardId":boardId,"sectionId":sectionId,"title":title,"priority":priority_value};
  9. desc = formValues.get("note");
  10. if(desc != "" && !desc.isEmpty())
  11. {
  12. parameters.put("desc",desc);
  13. }
  14. duedate = formValues.get("duedate");
  15. if(duedate != "" && !duedate.isEmpty())
  16. {
  17. duedate = duedate.toList("-");
  18. eyear = duedate.get(0);
  19. emonth = duedate.get(1);
  20. edate = duedate.get(2);
  21. parameters.put("eyear",eyear);
  22. parameters.put("emonth",emonth);
  23. parameters.put("edate",edate);
  24. }
  25. assignee = formValues.get("members");
  26. if(assignee != {} && !assignee.isEmpty())
  27. {
  28. userIds = list();
  29. for each  assgineeID in assignee
  30. {
  31. userIds.add(assgineeID.get("value"));
  32. }
  33. parameters.put("userIds",userIds.toString());
  34. }
  35. addTask = invokeurl
  36. [
  37. url :"https://connect.zoho.com/pulse/api/addTask"
  38. type :POST
  39. parameters:parameters
  40. connection:"" // Give your connection name
  41. ];
  42. if(addTask.get("addTask").get("stream").isEmpty() == false)
  43. {
  44. taskTitle = "[" + addTask.get("addTask").get("stream").get("task").get("title") + "](" + addTask.get("addTask").get("stream").get("url") + ")";
  45. taskpriority = addTask.get("addTask").get("stream").get("task").get("priority");
  46. tasksection = addTask.get("addTask").get("stream").get("task").get("section").get("name");
  47. taskboard = addTask.get("addTask").get("stream").get("partition").get("name");
  48. response = {"text":"Task added in " + taskboard + ". Take a look at the task details below.","card":{"title":"Task Details","theme":"modern-inline"},"slides":{{"type":"label","title":"Task Details: ","data":{{"Title":taskTitle},{"Priority":taskpriority},{"Section":tasksection},{"Board":taskboard}}}}};
  49. }
  50. return response;






End notes: 

Message actions in Cliq are super versatile like all other Cliq platform components. You can choose to create a message action that's specific to a message type. This example can be customized even to suit messages of the type attachments and links. So go ahead and give it a try! You can download the source code file attached with this post or access this link here: https://workdrive.zohoexternal.com/external/6OxchwzzBCF-J8HFH

Useful Links: 
Zoho Connect Rest API Guide: https://www.zoho.com/connect/api/intro.html



      • Sticky Posts

      • Automating leave alerts in Zoho Cliq

        The constant ebb and flow of employee absences can disrupt projects and hinder productivity. With Zoho Cliq's leave alert automation, you can easily keep your team informed. Real-time notifications can be sent to team chats, ensuring that everyone stays
      • 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

        • Recent Topics

        • Create Quote does not show the "Product Description" entered as part of the Product setup.

          The product description created as part of the product setup page, does not show in the Create Quote module; The module allows for an additional description to be added but without access to the original stored description. By selecting the product from the "Product Name Lookup" pop-up, the "Product Description" part should be populated from the product record where the user is allowed to further modify it.
        • Agents can manage the Tasks on the go, now with Zoho Desk mobile app

           Hello, Everyone!    We are elated to announce one of our most asked for features 'Tasks' in the Zoho Desk app.  Agents can now create and associate tasks with a ticket and the tasks will be listed within the corresponding tickets.   Steps to access the tasks from the app:    1. Go to a particular ticket in the app. 2. Click the Tasks icon in the 'Related Information' section.  3. List of all the tasks will be displayed.    Refer to the screenshots (Android & iOS) attached below for your better understanding:
        • Accountant

          Hi if I have a commercial company with multiple sales outlets, sales representatives and multi currency, what is the best subscription you offer? thanks.
        • Sign

          My name is Dolores Houghton. I signed up for sign package by mistake. I can’t use the program and I want my money back. I have been sent various instructions on how to delete and ask for a refund. Nothing works. I am not able to get into settings for
        • Sync CRM inventory data with Zoho Books

          I just switched everything over to ZoHo books, but I am trying to find out why the CRM Estimates, Invoices, and Sales Orders created in ZoHo CRM are not then duplicated in ZoHo Books? I had Quickbooks before, and had to do everything twice, I thought
        • Zoho CRM and Books integration (related list) column customization

          I was wondering if it's possible to add more cloumns (more informations) inside the related list that we get when we enable the integration. As you see we would like to be able to add more information on the invoice (or the same for PO in vendor).
        • Adding Client VAT and BRN in our Invoice

          Hi, Following request from our clients, we need to add their respective VAT and BRN in the invoice that we issue. Could you please let us know if this is something that we can do?
        • Zoho Analytics - Level on level queries

          I am facing a limitation of having too many level on level queries however some of my queries are complex and rely on multiple joins to get my desired output. How can I bypass this limitation as this is hindering my report creation.
        • Manipulate the Date Time field using deluge

          To update the DateTime field using deluge. CurrentVar = zoho.currenttime; TimeVar = zoho.currentdate + " 10:00:00"; if(CurrentVar > TimeVar.todatetime()) { CurrentNew = zoho.currenttime.toTime("yyyy-MM-dd'T'HH:mm:ss").toString("yyyy-MM-dd'T'HH:mm:ss+04:00");
        • Support streaming display of long texts in zobot chats (usefull for chatgpt / openAI and any other AI )

          Hello, I was able to test the new features you offer to connect chatgpt or openAI assistant with built-in feature or custom code. This is great but the chat seems very slow and laggy because you don't use streaming api from openAI, so the chat has to
        • Configure Notes Title for Blueprint Transition

          It'd be very helpful to be able to configure note titles on blueprint transitions when requiring notes. This would help tie back the history of notes to the blueprint actions. We have some approval processes in our blueprint and require notes for the
        • Website not publishing

          My website with Zoho (domain purchased on Zoho) - GilmoreGirlsGetaway.com - has been active for a few months now with no problems. I went to change the template and make modifications today, but as soon as I click "Publish" it says "Error occurred while publishing - contact support". The website preview looks fine, it just won't update. Thanks, Laura
        • ZDC Hackathon 2024 Category-wise Winners – Zoho CRM Client Script

          Hey everyone! After rigorous evaluation by our 14 expert judges, we’re beyond excited to announce that two incredible teams have won the Zoho CRM Client Script – Product Category award for their outstanding innovations! Team 1: Marcin Duchnowski Team
        • ZDC Hackathon 2024 Category-wise Winners – Zoho Creator

          Hey everyone! After rigorous evaluation by our 14 expert judges, we’re beyond excited to announce that two incredible teams have won the Zoho Creator – Product Category award for their outstanding innovations! Team 1: Wonderboy Thandanani MthiyaneTeam
        • ZDC Hackathon 2024 Category-wise Winners – Zoho CRM Custom Function

          Hey everyone! After rigorous evaluation by our 14 expert judges, we’re beyond excited to announce that two incredible teams have won the Zoho CRM Custom Function – Product Category award for their outstanding innovations! Team 1: Onur Gulay Team 2: Yonathan
        • ZDC Hackathon 2024 Category-wise Winners – Catalyst

          Hey everyone! After rigorous evaluation by our 14 expert judges, we’re beyond excited to announce that two incredible teams have won the Catalyst – Product Category award for their outstanding innovations! Team 1: Raghavan P, Santhosh Kumar K, and Jayabalan
        • ZDC Hackathon 2024 Category-wise Winners – Extensions

          Hey everyone! After rigorous evaluation by our 14 expert judges, we’re beyond excited to announce that two incredible teams have won the Extensions – Product Category award for their outstanding innovations! Team 1: Puneet Chandhok, Parv Kumra and Akriti
        • ZDC Hackathon 2024 Category-wise Winners – Zoho SalesIQ Zobot

          Hey everyone! After rigorous evaluation by our 14 expert judges, we’re beyond excited to announce that two incredible teams have won the Zoho SalesIQ Zobot – Product Category award for their outstanding innovations! Team 1: Naveenkumar M, Tulasidhasan
        • Announcing the Zohotshots of the ZDC Hackathon 2024

          Hey everyone! After 46 days of innovation, collaboration, and intense competition, the first-ever Zoho Developer Community (ZDC) Hackathon has officially concluded! 🎉 With 1079 participants, 797 teams, and representation from 45 countries across 6 continents,
        • Retrieve separate records from multiselect lookup field

          Hi, I know there are many post on this one, but I just don't get it. I have a multiselect look-up field named Delivery containing 3 different informations like this : Montreal - Tuesday - 3 to 4 pm I need to do an IF script based on the first item in
        • Cannot set Subform Multiline field to read-only using Client Script

          I am using client script to set different subform fields as read-only It works for Single Line Fields, but when I try to set a Multiline field as Read-only it doesn't work var subform = ZDK.Page.getSubform("Subform_1"); var item_Code_old = subform.getField('Item_Code_Old').setReadOnly(true);
        • Round robin not processing backlog tickets

          We set up a round-robin for one of our departments which initially worked, but something seems to have broken during the 'tweaking' process as it will no longer assign backlogged tickets of any kind. (I've included images of the settings.) Based on the
        • Deluge script that creates a popup with a dropdown list of choices

          Hi, In an order form, when a portal user choose a delivery day, another field is automatically filled with a delivery location, and that field is not linked with a lookup. I have now one day of the week that has 2 delivery locations. I do not want to
        • Schedule workflows to run on business days only (not weekends)

          Is there any way in Bigin to set workflow automation emails to run only on business days (Monday-Friday) and not weekends? It will be strange for my customer to receive an email from us on a Sunday for example, if my workflow is set to send an email in
        • A way to view the sales of leads conversion that were successful

          Hi there, I have a question about this analytic component that can be selected in the dashboard. Currently it shows the conversion rate of leads plus how many leads went to deals and how many won deals. I want to be able to view how much sales the lead
        • Lookup Field Values In BulkRead

          I am pulling cases from the Zoho Case module using the BulkRead API. However, I am receiving IDs (random numbers) as field values. I later discovered that if I include column_name.Name in the returned fields, I get the actual value. However, this approach
        • Email alias per task list so these tasks don't get listed under a 'General' task list that we didn't create nor use

          Using an email alias to add tasks is very good for forwarding emails directly into Zoho Projects however everything gets listed under a 'General' task list which is counter-intuitive. It would be good to have an email alias for each task list so we can
        • CRM portal users can now log in using their mobile phone numbers

          Hello everyone! You can now invite portal users using their mobile phone numbers. These portal users will be able to log in using their mobile number and OTP. Templates for these portal-related SMS can be customized as per your needs. This enhancement
        • Menu Bar

          Hi, Please guide how to change menu bar from vertical to horizontal
        • Zoho Signing embedded with iframe is moved out of view when navigating to focus signature on mobile devices

          Dear Zoho team, I'm having difficulty embedding the signing url into a website for users to sign on their phones, it's not working perfectly. The problem occurs after the user accepts and continues to sign, or the user clicks to redirect to any of the
        • Insert information on another form of a Zoho loginuser

          Hello, I have 2 forms that are linked, a customer form, and then a subscription form in which there will be a subscription number that I would like to transfer back in a field of the first form called "current subscription number", How do I write the
        • Confirmation prompt before a custom button action is triggered

          Have you ever created a custom button and just hoped that you/your users are prompted first to confirm the action? Well, Zoho knows this concept. For example, in blueprint, whenever we want to advance to the next state by clicking the transition, it is
        • Canvas View in Zoho Recruit

          Is it possible or would it be possible to have the new 'Canvas View' in Zoho Recruit?
        • Kaizen #78 : How to disable clone record?

          Hello everyone! Welcome back to another interesting Kaizen post. In this post, let us discuss a workaround solution for the use case - How to disable clone record for a user. Requirement Consider that you want to disable the clone option for the Deals
        • Automated Shopify adjustment problem. "An inventory adjustment has been created by the system to set the initial stock from Shopify"

          Has anyone noticed issues since the Shopify Sync has been updated recently? If you sync with Shopify, check to see if there are automated adjustments for old products that keep recurring. We have this problem for 6 SKU's that Zoho is doubling the stock
        • Mass-Delete-Action over API doesn't work because of scope

          Hi all, we're currently trying to mass delete 40000 deals from our CRM, that we have already put into a custom view. I'm not that used to the API, but I managed to authenticate by https://accounts.zoho.com/oauth/v2/token with Postman and going by the
        • Can you be a Learner as well as a Contributor

          If you are the Author or a Contributor, can you also be assigned as a Learner? This is particularly relevant if you need to certify that you have taken the quiz and done the learning yourself!
        • Merge Tickets Directly from Contact Page in Zoho Desk

          Dear Zoho Desk Support Team, We are writing to request a new feature that would allow users to easily merge tickets directly from the contact page in Zoho Desk. Currently, the only option to merge tickets is from the Tickets list view page, which can
        • Important update in Zoho Forms: Enhancements for improved email deliverability

          Hello, form builders! We would like to inform you about some changes we're making in Zoho Forms to ensure the deliverability of your outbound emails. Changes to Gmail policies Gmail has updated its DMARC policy which quarantines emails sent with gmail.com
        • Multiple Vendor SKUs

          One of the big concerns we have with ZOHO Inventory is lack of Vendor Skus like many other inventory software packages offer. Being able to have multiple vendor skus for the same product would be HUGE! It would populate the appropriate vendor Sku for
        • Next Page