Introduction to Slash Commands in Cliq

Introduction to Slash Commands in Cliq

In Steve Jobs' words,

The most precious resource we all have is time.


And rightly so, aren't we all looking for quick ways to perform our tasks? Automating even the most trivial actions, can save us some time and make us more productive. If you are looking for an interface to quickly carry out your actions, then Slash Command is the answer. So today, lets learn about slash commands and also try programming a simple command. 

Now that I've kindled your curiosity, let me give a brief overview about slash commands. Slash commands is an interface, with a fixed syntax and can be triggered to complete your task or perform an action right inside the chat window. If using a slash command is easy, creating one is way more easier and interesting. More about creating and managing slash commands are explained in our help page. Additionally, watch this video on how to create and execute a slash command!



Let us try building a command /weather that can fetch you the weather information of a location. The use case we are looking at here, is to get the weather details for the day or to fetch the weather forecast details for the upcoming five days. 
  
The next step would be to get necessary APIs. The APIs used are from https://developer.accuweather.com/apis. Once you source out the necessary APIs, create the command by giving the name, description, hint followed by command parameters. 

The command parameters (options) we require here are :
- city : To get the location from the user. ( Drop a hint to the user to mention the place name! ) 
 
The command execution flow is given in the flowchart below:


Breaking down the command execution flow in 2 simple steps: 
 
1. Each location is assigned with a location key. To get the weather details for a location, the first step would be to get this location key for the place mentioned in the command input parameter. 
 
2. This location key is then used in either the current conditions URL or the weather forecast conditions URL. This again depends on the command input. 
 
Take a look at the /weather command execution code: 
 
  1. //Define new empty Map expressions, Message and Card - to post message on command execution. 

  2. message = Map(); 
  3. card = Map(); 
  4. card.put("theme","modern-inline"); 
  5. card.put("title","Weather Information"); 

  6. //Store the user entries (options) in the a variable 

  7. place = options.get("city"); 
  8. locationURL = "http://dataservice.accuweather.com/locations/v1/cities/search?apikey=API_KEY&q=" + encodeurl(place) + ""; 
  9. response = getURL(locationURL); 

  10. // Convert the string response to a map to get the "Location Key" from the response. Store the location key in a variable. 
  11. locationkey = response.toMap().get("Key"); 

  12. // Any string passed while executing a command will be stored in"arguments" 

  13. if(arguments.containsIgnoreCase("forecast")) 
  14. //API to get weather forecast for the specified location 
  15. ForecastURL = "http://dataservice.accuweather.com/forecasts/v1/daily/5day/" + encodeurl(locationkey) + "?apikey=API_KEY"; 
  16. forecastdata = getURL(ForecastURL); 

  17. // Convert the response to a map. 
  18. DailyForecasts = forecastdata.toMap().get("DailyForecasts"); 

  19. // From the response obtained, get the information you would like to show in your command response. And organize it in a table and post as a message card! 
  20. slides = List(); 
  21. slidedata = Map(); 
  22. slidedata.put("type","table"); 
  23. rows = List(); 
  24. for each DailyForecast in DailyForecasts 
  25. clock = DailyForecast.get("Date"); 
  26. Time = clock.getDay()+"/"+clock.getMonth(); 
  27. Temp = DailyForecast.get("Temperature").toMap().get("Minimum").toMap().get("Value"); 
  28. Celsius = ((Temp - 32) * 0.5556).round(1) + "°C"; 
  29. row = Map(); 
  30. row.put("Date", Time); 
  31. row.put("Temperature",Celsius); 
  32. rows.add(row); 
  33. }
  34. data = Map(); 
  35. headers = List(); 
  36. headers.add("Date"); 
  37. headers.add("Temperature"); 
  38. data.put("headers",headers); 
  39. data.put("rows",rows); 
  40. slidedata.put("data",data); 
  41. slides.add(slidedata); 
  42. message.put("slides",slides); 
  43. message.put("text","Weather forecast for the next 5 days in "+place ); 

  44. }
  45. else 
  46. CurrentWeatherURL = "http://dataservice.accuweather.com/currentconditions/v1/" + encodeurl(locationkey) + "?apikey=API_KEY"; 

  47. // API to get current weather conditions for the specified location 
  48. current_weather_data = getURL(CurrentWeatherURL); 

  49. // Convert the string response to a map. 
  50. WeatherInfo = current_weather_data.toMap(); 

  51. // From the response obtained, get the information you would like to show in your command response. 
  52. climateinfo = WeatherInfo.get("WeatherText"); 
  53. climate = WeatherInfo.get("Temperature"); 
  54. Metrics = climate.get("Metric"); 
  55. Celcius = Metrics.get("Value"); 
  56. Unit = Metrics.get("Unit"); 

  57. // The required information from the response will be posted as a message 
  58. message.put("text","The weather in " + place + " is " + climateinfo + " with a temparature of " + Celcius + "°" + Unit + ""); 

  59. //Post the message to a chat with the help of the deluge task : zoho.cliq.postToChat (); 
  60. aa = zoho.cliq.postToChat(chat.get("id"),message); 
  61. message.put ("card",card); 
  62. return message; 

And that's how you can use a simple slash command to fetch weather details, right inside your chat window! Let us know how this post helped you. Feel free to post your queries , suggestions here!

Cheers,
Manasa 
Cliq                   


      • 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

        • Recent Topics

        • Zoho Bookings know-how: A hands-on workshop series

          Hello! We’re conducting a hands-on workshop series to help simplify appointment scheduling for your business with Zoho Bookings. We’ll be covering various functionalities and showing how you can leverage them for your business across five different sessions.
        • Custom report

          Hello Everyone I hope everything is fine. I've tried to To change the layout of the reports, especially the summary page report, and I want to divide summary of each section in the survey but I can't For example: I have a survey containing five different
        • Zoho Journey - ZOHO MARKETING AUTOMATION

          I’ve encountered an issue while working with a journey in Zoho Marketing Automation. After creating the journey, I wanted to edit the "Match Criteria" settings. Unfortunately: The criteria section appears to be locked and not editable. I’m also unable
        • Custom Fields in PDF outputs

          I created a couple of custom fields. e.g Country of Origin and HS Tariff Code. I need these to appear on a clone of a sales order PDF template but on on the standard PDF template. When I select "appear on PDFs' it appears on both but when I don't select
        • How to create a Service Agreement with Quarterly Estimate

          Hello, I'm not sure if this has been asked before so please don't get mad at me for asking. We're an NDIS provider in Australia so we need to draft a Service Agreement for our client. With the recent changes in the NDIS we're now required to also include
        • Change Currency symbol

          I would like to change the way our currency displays when printed on quotes, invoices and purchase orders. Currently, we have Australian Dollars AUD as our Home Currency. The only two symbol choices available for this currency are "AU $" or "AUD". I would
        • Python - code studio

          Hi, I see the code studio is "coming soon". We have some files that will require some more complex transformation, is this feature far off? It appears to have been released in Zoho Analytics already
        • Zoho Social - Post Footer Templates

          As a content creator I often want to include some information at the end of most posts. It would be great if there was an option to add pre-written footers, similar to the Hashtag Groups at the end of posts. For example, if there is an offer I'm running
        • Seriously - Create multiple contacts for leads, (With Company as lead) Zoho CRM

          In Zoho CRM, considering a comapny as a lead, you need us to allow addition of more than one contact. Currently the Lead Section is missing "Add contact" feature which is available in "Accounts". When you know that a particular lead can have multiple
        • The Social Wall: August 2025

          Hello everyone, As summer ends, Zoho Social is gearing up for some exciting, bigger updates lined up for the months ahead. While those are in the works, we rolled out a few handy feature updates in August to keep your social media management running smoothly.
        • Ugh! - Text Box (Single Line) Not Enough - Text Box (Multi-line) Unavailable in PDF!

          I provide services, I do not sell items. In each estimate I send I provide a customized job description. A two or three sentence summary of the job to be performed. I need to be able to include this job description on each estimate I send as it's a critical
        • Allow to pick color for project groups in Zoho Projects

          Hi Zoho Team, It would be really helpful if users could assign colors to project groups. This would make it easier to visually distinguish groups, improve navigation, and give a clearer overview when managing multiple projects. Thanks for considering
        • Zoho Books - Quotes to Sales Order Automation

          Hi Books team, In the Quote settings there is an option to convert a Quote to an Invoice upon acceptance, but there is not feature to convert a Quote to a Sales Order (see screenshot below) For users selling products through Zoho Inventory, the workflow
        • Can't find imported leads

          Hi There I have imported leads into the CRM via a .xls document, and the import is showing up as having been successful, however - when I try and locate the leads in the CRM system, I cannot find them.  1. There are no filters applied  2. They are not
        • Custom Button Disappearing in mobile view | Zoho CRM Canvas

          I'm working in Zoho CRM Canvas to create a custom view for our sales team. One of the features I'm adding is a custom button that opens the leads address in another tab. I've had no issue with this in the desktop view, but in the mobile view the button
        • The connected workflow is a great idea just needs Projects Integrations

          I just discovered the connected workflows in CRM and its a Great Idea i wish it was integrated with Zoho Projects I will explain our use case I am already trying to do something like connected workflow with zoho flow Our requirement was to Create a Task
        • Zoho Projects MCP Feedback

          I've started using the MCP connector with Zoho Projects, and the features that exist really do work quite well - I feel this is going to be a major update to the Zoho Ecosystem. In projects a major missing feature is the ability to manage, (especially
        • Function #10: Update item prices automatically based on the last transaction created

          In businesses, item prices are not always fixed and can fluctuate due to various factors. If you find yourself manually adjusting the item rates every time they change, we have the ideal time-saving solution for you. In today's post, we bring you custom
        • email template

          How do I create and save an email template
        • Enhancements in Portal User Group creation flow

          Hello everyone, Before introducing new Portal features, here are some changes to the UI of Portals page to improve the user experience. Some tabs and options have been repositioned so that users can better access the functionalities of the feature. From
        • Archiving Contacts

          How do I archive a list of contacts, or individual contacts?
        • How do I filter contacts by account parameters?

          Need to filter a contact view according to account parameter, eg account type. Without this filter users are overwhelmed with irrelevant contacts. Workaround is to create a custom 'Contact Type' field but this unbearable duplicity as the information already
        • Can I add Conditional merge tags on my Templates?

          Hi I was wondering if I can use Conditional Mail Merge tags inside my Email templates/Quotes etc within the CRM? In spanish and in our business we use gender and academic degree salutations , ie: Dr., Dra., Sr., Srta., so the beginning of an email / letter
        • Zoho CRM button to download images from image upload field

          Hello, I am trying to create a button in Zoho CRM that I can place in my record details view for each record and use it to download all images in the image upload fields. I tried deluge, client scripts and even with a widget, but feel lost, could not
        • 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
        • email moderation issue when email is sent in the name of a mail group

          Symptom: an email that is sent by a mail group moderator in the name of a moderated mail group is held back for approval. Reproduction: Create a moderated mail group with members and moderators. Allow that mails can be sent in the name of the group (extended settings). Send an email to the group as a group moderator, but in the name of the group. This mail is held back for moderation which is unexpected. Expected: A mail sent by group moderator to a moderated group are not held back for moderation
        • blank page after login

          blank page after logging into my email account Thanks you
        • Introducing the revamped What's New page

          Hello everyone! We're happy to announce that Zoho Campaigns' What's New page has undergone a complete revamp. We've bid the old page adieu after a long time and have introduced a new, sleeker-looking page. Without further ado, let's dive into the main
        • Always display images from this sender – Is this feature available?

          In Zoho mail, I had my "Load external images" setting set to "Ask me", and that's fine. That's the setting I prefer. What's not fine though is I always need to tick "Display now" for each email I get, regardless if I've done that multiple times from several
        • Function #9: Copy attachments of Sales Order to Purchase Order on conversion

          This week, we have written a custom function that automatically copies the attachments uploaded for a sales order to the corresponding purchase order after you convert it. Here's how to configure it in your Zoho Books organization. Custom Function: Hit
        • Free webinar: Security that works: Building resilience for the AI-powered workforce

          Hello there, Did you know that more than 51% of organizations worldwide have experienced one or more security breaches, each costing over $1 million in losses or incident response? In today’s threat landscape, simply playing defense is no longer enough.
        • "Subject" or "Narration"in Customer Statement

          Dear Sir, While creating invoice, we are giving in "Subject" the purpose of invoice. For Example - "GST for the month of Aug 23", IT return FY 22-23", "Consultancy", Internal Audit for May 23". But this subject is not coming in Customer Statement. Only
        • Zoho Books Sandbox environment

          Hello. Is there a free sandbox environment for the developers using Zoho Books API? I am working on the Zoho Books add-on and currently not ready to buy a premium service - maybe later when my add-on will start to bring money. Right now I just need a
        • Apply Vendor Credit Automatically

          Hello!!! Is there a way where in we can apply vendor credits automatically on the FIRST OUTSTANDING BILL of the vendor?? We have lots of VENDOR CREDITS ISSUES mostly!!! Applying it manually is a pain for us. Would be great if we have a way to apply the
        • Cliq iOS can't see shared screen

          Hello, I had this morning a video call with a colleague. She is using Cliq Desktop MacOS and wanted to share her screen with me. I'm on iPad. I noticed, while she shared her screen, I could only see her video, but not the shared screen... Does Cliq iOS is able to display shared screen, or is it somewhere else to be found ? Regards
        • Retainer Invoice.

          Why ZOHO not have facilities to deduct partially advance payment from an invoice.
        • Apply Vendor Credits Automatically

          We are bulk importing Vendor credits in Zoho Books!!! Is there a way to apply vendor credits automatically to the first UNPAID bill of the Vendor?
        • ResponseCode 421, 4.7.0 [TSS04] Messages from 136.143.188.51 temporarily deferred due to user complaints

          Had email bounce. Let me know if you can fix this. Thanks. Michael
        • Cant Save Gauge on Creator Page

          How to Save Gauge on Creator Page see movie https://vimeo.com/1116410860?share=copy#t=0
        • Apply Advance option not shown in report

          We are facing an issue in Zoho Expenses. While approving an Expense Report, the "Apply Advance" option is not appearing under the three dots (More Options). Details: Module: Expense Reports Issue: "Apply Advance" option not visible Status of Report: Awaiting
        • Next Page