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

        • Displaying related quotes in sales order and back

          Hi, My colleague liked to see to which sales orders, the quote has been converted. Quote shows Invoices, but not SO. Same, they would like to see the quotes in the sales order, as they can see invoices, packages, shipment, How can we achieve this ? Thank
        • Tip of the Week #71–Auto-move incoming messages to the right inboxes with keywords

          We all know that customer-facing teams, especially your sales and support teams, can’t afford to miss even a single customer conversation. But sometimes, sales queries or support requests can easily get lost in a crowded inbox or even end up in the wrong
        • Clearing Fields using MACROS?

          How would I go about clearing a follow-up field date from my deals? Currently I cannot set the new value as an empty box.
        • Bigin: filter Contacts by Company fields

          Hello, I was wondering if there's a way to filter the contacts based on a field belonging to their company. I.e.: - filter contacts by Company Annual Revenue field - filter contacts by Company Employee No. field In case this is not possibile, what workaround
        • Sending emails from an outlook account

          Hi, I need to know if it's possible to send automatic emails from an Outlook account configured in Zoho CRM and, if so, how I can accomplish that. To give you some context, I set up a domain and created a function that generates PDF files to be sent later
        • Migrating a Zoho Forms form into Zoho Creator

          Hi, How can I migrate my Zoho Forms form into Zoho Creator? Thanks. Truly, Emad
        • Is there any way to recall an email sent using Zoho CRM?

          If an email is sent using Zoho Mail, there is a recall option/functionality that is available to the sender. Is there any way to recall an email if it was sent using Zoho CRM? I can't seem to find that option. Any help would be appreciated.
        • Quick Create needs Client Script support

          As per the title. We need client scripts to apply at a Quick Create level. We enforce logic on the form to ensure data quality, automate field values, etc. However, all this is lost when a user attempts a "Quick Create". It is disappointing because, from
        • is it possible to add more than one Whatsapp Phone Number to be integrated to Zoho CRM?

          so I have successfully added one Whatsapp number like this from this User Interface it seems I can't add a new Whatsapp Number. I need to add a new Whatsapp Number so I can control the lead assignment if a chat sent to Whatsapp Phone Number 1 then assign
        • Problem with reports due to "Connected" items change - Yes this IS a problem

          Now that the change has been made to use "connected" items I can no longer run the reporting I need in CRM. I should be able to start with Deals as the parent, connect down to the Account (Account_Name) on the deal as the child, then to any child items
        • Zoho sheet desktop version

          Hi Zoho team Where can I access desktop version of zoho sheets? It is important as web version is slow and requires one to be online all the time to do even basic work. If it is available, please guide me to the same.
        • Introducing notifications in the vendor portal

          Imagine this: You're a recruiter working with multiple vendors on a high-volume hiring project. You’ve just updated a job description after a last-minute change from the hiring manager. One of your vendors, however, is still working off the older version
        • CRM limit reached: only 2 subforms can be created

          we recently stumbled upon a limit of 2 subforms per module. while we found a workaround on this occasion, only 2 subforms can be quite limiting in an enterprise setting. @Ishwarya SG I've read about imminent increase of other components (e.
        • LESS_THAN_MIN_OCCURANCE - code 2945

          Hi I'm trying to post a customer record to creator API and getting this error message. So cryptic. Can someone please help? Thanks Varun
        • How to update "Lead Status" to more than 100 records

          Hello Zoho CRM, How do I update "Lead Status" to more than 100 records at once? To give you a background, these leads were uploaded or Imported at once but the lead status record was incorrectly chosen. So since there was a way to quickly add records in the system no matter how many they are, we are also wondering if there is a quicker way to update these records to the correct "Lead Status". I hope our concern makes sense and that there will be a fix for it. All the best, Jonathan
        • Analytics for notes created

          Is there a way I can see how many notes were created per day? Via reporting or analytics?
        • Add Custom Reports To Dashboard or Home Tab

          Hi there, I think it would be great to be able to add our custom reports to the Home Tab or Dashboards. Thanks! Chad
        • Cannot update Recurring_Activity on Tasks – RRULE not accepted

          Hello, I am trying to update Tasks in Zoho CRM to make them recurring yearly, but I cannot find the correct recurrence pattern or way to update the Recurring_Activity field via API or Deluge. I have tried: Sending a string like "RRULE:FREQ=YEARLY;INTERVAL=1"
        • Add image to report...

          Greetings, I send a weekly color coded report via Creator email. I would like to add the legend somewhere in the report. Header, footer where ever. I have the legend saved on Google Drive and can access it via shared link. Sure someone has wanted to add
        • More controls for User Fields in CRM

          Dear All, We are here with a minor but crucial enhancement to the user fields—now set accessibility permissions to the records for user field. User field allows you to extend co-ownership of records to your peers. You can collaborate with them for certain
        • Calls to accounts rather than leads or contacts?

          So..... We have a dilemma and I'm hoping someone has encountered this before and figured out a fix. We have just migrated to Zoho. It's great.....expect for how "Calls" are handled.... We are B2B. We do not use the leads module. A "Lead/Prospect" for
        • Image Upload Field | Zoho Canvas

          I'm working on making a custom view for one of our team's modules. It's an image upload field (Placement Photo) that would allow our sales reps to upload a picture of the house their working on. However, I don't see that field as a opinion when building
        • Power of Automation :: Automated 'Delayed & Closed' Status Update Based on Due Date

          Hello Everyone, A custom function is a software code that can be used to automate a process and this allows you to automate a notification, call a webhook, or perform logic immediately after a workflow rule is triggered. This feature helps to automate
        • Lead Blueprint transition in custom list view

          Hi, Is It possible to insert the Blueprint transition label in a custom Canvas list view? I am using Lead module. I see the status, but it would be great if our users could execute the Blueprint right from the list view without having to enter the detailed
        • Range names in Zoho Sheet are BROKEN!

          Hi - you've pushed an update that has broken range names. A previously working spreadsheet now returns errors because the range names are not updating the values correctly. I've shared a video with the support desk to illustrate the problem. This spreadsheet
        • Can Zoho Flows repeat Actions more than once?

          I'm attempting to make an intentional Zoho Flow loop using the below layout. However, when "WithinLimit" condition is met, the program fails to execute the action "Get & Add Request Co..." again. Is this by design? Is Zoho Flows unable to repeat actions
        • Has anyone integrated SMS well for Zoho Desk?

          Our company does property management and needs to be able to handle inbound sms messages which create a ticket for Zoho Desk. We then need to be able to reply back from Zoho desk which sends the user an sms message. This seems like a fairly common thing
        • populate email address and name in zoho desk?

          Is it possible to populate the email address and name in the zoho desk widget? We only use it in the context of an authenticated user, so we already know the user's name and email. Thanks,
        • Are there default/pre-built dashboards in Zoho Desk?

          Hi, I am looking for some pre-built dashboard templates in Zoho Desk, similar to what we can find in CRM/Projects, etc Thank you
        • Enable Locations for Expense

          Hi, please enable Locations (ex Branches) for Zoho Expense so that there is consistency between this app and Zoho Books. Thanks in advance.
        • Adding branded signature to tickets reply

          Hi, i am unable to figure out how to add signatures with logo to tickets reply. please advice .
        • Zoho Calendar not working since a few days

          Hey there, first off a minor thing, since I just tried to enable the Calendar after reading this in another topic (there was no setting for this though) : For some reason my current session is showing me based in New York - I'm in Germany, not using a
        • Zoho Marketing Automation 2.0 - Landing Page function not working

          Dear Zoho Team, I am working on implementing Zoho Marketing Automation 2.0, and am now looking into the section "Lead Generation". If I open the "Landing Pages" section, I immediately get an Error code: Error: internal error occurred. Can you help me
        • WebDAV / FTP / SFTP protocols for syncing

          I believe the Zoho for Desktop app is built using a proprietary protocol. For the growing number of people using services such as odrive to sync multiple accounts from various providers (Google, Dropbox, Box, OneDrive, etc.) it would be really helpful if you implemented standard protocols such as WebDAV / FTP / SFTP so that alternative inc clients can be used.
        • Zoho Mail Android app update: Manage folders

          Hello everyone! In the latest version(v2.9) of the Zoho Mail Android app update, we have brought in support for an option to manage folders. You can now create, edit, and delete folders from within the mobile app. You can also manage folders for the POP
        • How to share ticket numbers across different ticket types

          I'm running an event and have three different ticket types. Add on Event + Main Event - Early bird Main Event only - Early bird Add on Event only - Early bird And Standard class - shown but not available until early bird finishes Add on Event + Main Event
        • Adding Social Media Buttons to Basic Campaigns

          Hi, I'm quote new to using Zoho Campaigns and I can't work out how to add Social Media Buttons into my basic campaign? In MailChimp there's a button that brings the icons into your campaign for you. I've tried adding the social media icons as 'buttons' in Zoho but it's not looking great. Can anyone help? Thanks!
        • Hide Inactive Social Sign-In Providers from Login Screen

          Hello Zoho Team, We hope you are doing well. Currently, Zoho One allows admins to configure security policies and enable or disable Social Sign-In options for third-party providers such as Apple, Google, Microsoft, LinkedIn, Yahoo, Twitter, Facebook,
        • Zoho Cliq not working on airplanes

          Hi, My team and I have been having this constant issue of cliq not working when connected to an airplane's wifi. Is there a reason for this? We have tried on different Airlines and it doesn't work on any of them. We need assistance here since we are constantly
        • [Free Webinar] AI Agents in Zoho Creator - Creator Tech Connect

          Hello Everyone! We welcome you all to the upcoming free webinar on the Creator Tech Connect Series. The Creator Tech Connect series is a free monthly webinar that runs for around 45 minutes. It comprises technical sessions in which we delve deep into
        • Next Page