The Slash Command Series - Command suggestions - The power of choosing!

The Slash Command Series - Command suggestions - The power of choosing!

Command suggestions are a cluster of simple inputs given by the system to the user. Simply put, a suggestion list displays options for the command input. The idea behind using command suggestions is to make it easy for the end user, by showing the inputs while executing a command. 

Most often we find ourselves in a quintessential position where we're looking for a file or a folder packed away in a corner! Think about situations where your Manager and your Mentor ask you to share two different files?  Oh! how easy will it be when you get the list of files you've stored in your online cloud storage.  Now, think of a way where you can get and share these files directly from your chat window. Oh yes! You read that right. 

The /zdocs command gives you the list of folders you've created in your Zoho Docs Account. Select the folder you need and done! The files which are not saved in any folder will be added in the default folder. The command is executed to give you a list of files in that folder, with a share button. Select the file you wish and share and click share. 

/zdocs Command Workflow

Invoke URL : Invoke operations from Cliq to Zoho Docs by using the Invoke URL task. Plays an integral part throughout the command  list suggestion and execution. ( Learn More )

Command Suggestion Handler : The handler is triggered to show a list of folders from your  Zoho Docs account as and when you type the folder name

Click to Execute : Enabling the click to execute option triggers the command execution when you choose a folder from the list.

Command Execution : Click to Execute option, prompts this handler to post the list of files in that particular folder.

Button Function : Clicking on the 'Share' button next to a file, shares the file with the users in a chat! 

Now that we're familiar with the workflow, let's have a look at each fragment. Our slide deck conveys briefs the whole post to you in just 2 minutes!

Invoke URL 

A connection with Zoho Docs is necessary to invoke operations from Cliq. We use the invoke URL function code generated by creating a connection. For step by step details on creating a connection and the invoke URL task, refer our help guide on  Connections

Sample Invoke URL task

  1. response = invokeUrl
  2. [
  3. url : <url>
  4. type: <GET/PUT/POST/DELETE>  
  5. parameters: <parameters>        
  6. headers: <headers>             
  7. connection: <connection name>  
  8. files: <file object>            
  9.  ]; 
  10. * The url and type parameters are mandatory here.

Substitute the Get Folders API from Zoho Docs, mention the HTTP Method, and connection name to use it in the command suggestion handler.

  1. Invoke URL Task in Command Suggestion Handler
  2.  url = " https://apidocs.zoho.com/files/v1/folders/files";
  3.  folders = invokeurl
  4. [
  5.       url: url
  6.       type:GET
  7.       connection:zdocs
  8. ];

Similarly, this invoke URL task is used in the command execution handler and the function execution code. 

Command Suggestion Handler  

This handler is responsible for listing out the folders as suggestions. Take a look at the code snippet below!

  1. list = List();
  2. if(selections.size() == 0)
  3. {
  4. folders = invokeurl
  5. [
  6. url :" https://apidocs.zoho.com/files/v1/folders"
  7. type :GET
  8. connection:"zdocs"
  9. ];
  10. folders.remove(0);
  11. //info folders;
  12. for each  folder in folders
  13. {
  14. entry = {"title":folder.get(0).toMap().get("FOLDER_NAME"),"id":folder.get(0).toMap().get("FOLDER_ID")};
  15. //info entry;
  16. foldername = entry.get("title");
  17. info foldername;
  18. if(foldername.contains(arguments))
  19. {
  20. list.add(entry);
  21. }
  22. }
  23. entry1 = Map();
  24. entry1.put("title","Default Folder");
  25. list.add(entry1);
  26. }
  27. return list;


Command Execution Handler

The command is executed to display a list of files present under the selected folder. Enabling the Click to Execute option directly triggers command execution. 

Function Execution Code

Our aim for the button function here is to share the file when the user clicks the 'Share' button! 

The command execution and function execution codes are attached below. Download them and let us know how this command helped you.

Oh and also, check this post  on how Zoho Creator and Cliq come together to make the /poll command work! 

Links to Refer: 

Help guide: Commands Suggestions

Zoho Docs APIs: Zoho Docs API List

Suggestions and discussions are welcome! 

Best, 
Manasa 
Cliq  






                            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

                                        • 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
                                        • The Slash Command Series - Types of Command Suggestions

                                          Hi Everybody! I hope you guys tried the /zdocs command and now have an idea of how command suggestions with click to execute work. If you have no clue of what command suggestion is, I recommend you to take a look at all the Slash Command Series posts, especially the one on Command Suggestions ! This post is all about the different types of command suggestions.  Customise your command suggestions  Did you know you could customise your command suggestion list with a title, description, image? Well,


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

                                                                      





                                                                      




                                                                          Design. Discuss. Deliver.

                                                                          Create visually engaging stories with Zoho Show.

                                                                          Get Started Now