About schedulers
Schedulers are the newest addition to Cliq's Platform Components and also a blessing in disguise to manage our ever growing list of work items! Schedulers allow you to trigger and perform timed actions. These actions can be anything such as a simple scheduler that posts a message in the team channel, asking everyone to update their weekly status or a scheduler that is triggered every morning to bring the list of tasks from your task list!
Configuring schedulers
This is a pretty straightforward process. Start off by choosing when you'd like to execute the scheduler, it can be everyday or weekly or even on a monthly basis. A detailed description of the various options available for configuring is given in this
help page. And finally, decide if your scheduler should post the message in a channel or to a user or to a bot with the help of our simple deluge tasks!
What next?
Once you are happy with the scheduler's code, save it! Now, the most important part is to take your scheduler for a trial run. Click on your scheduler's name to open the Scheduler Preview. Click on the Trial Run button to execute the scheduler and give a response.
Note: If your scheduler contains connections, then you'll get a dialog prompt asking permission to access that third party application's account. Click on Allow Access and grant permission!
Launch a scheduler now!
There can be countless number of reasons why people build a scheduler using Cliq Platform. A great example would be the Zylker User Education Team. This team uses the
Todoist Application to keep track of their tasks for the day and make it a point to update all their tasks, however minute it might be in Todoist. So, it is quite natural for them to keep checking Todoist for adding, updating or checking if any other task is added. Now the team uses Cliq to communicate within themselves and also with other teams as well! An ideal solution would be to create a bot which can create a task, bring pending tasks for you and a scheduler that runs every morning to get the list of tasks for the day to post it in a channel! Take a look at the workflow behind this particular scheduler
To create a custom connection with Todoist
- Create an applet for Cliq in Todoist and generate a Client ID and Client Secret.
- Give the Client ID and Secret followed by the Authorization URL, Access Token URL and the Refresh Token URL in Cliq's create connection page.
- Give your connection name and define the scopes to access different modules.
- Save your connection and use the invoke URL task it in your scheduler code!
Once this is done, create your scheduler.
To create a scheduler in Cliq
- Go to Integrations in Cliq's top nav bar.
- Select Schedulers and click on Create Scheduler.
- Give your scheduler name and description.
- Select the scheduler recurring period as 'Everyday' and recurring time as '9.00 A.M'
- Click Save & Edit Code.
Here's a short video on the custom connection and scheduler's creation.
The sample code snippet for the todoist scheduler is given below. Find the instant button's function code snippet attached!
- message = Map();
- response = invokeurl
- [
- url :" https://beta.todoist.com/API/v8/tasks "
- type :GET
- connection:"<insert_your_connection_link_name>"
- ];
- task = response.toList();
- if(task.size() > 0)
- {
- rows = List();
- for each taskItem in task
- {
- content = taskItem.get("content");
- info content;
- url = taskItem.get("url");
- info url;
- row = Map();
- row.put("Task Name"," :task: " + content);
- row.put("Mark as complete","[+Complete](invoke.function|<function_name>|<insert_your_email_address>|" + taskItem.get("id") + ")");
- row.put("View Task","[View Task](" + url + ")");
- rows.add(row);
- }
- message = {"text":"Hey there, your list of tasks is here!","bot":{"name":"Todoist","image":"<insert_image_url>" },"slides":{{"type":"table","title":"","data":{"headers":{"Task Name","Mark as complete","View Task"},"rows":rows}}}};
- }
- else
- {
- message = {"text":"Looks like there are no tasks for today! :grinning: "};
- }
- zoho.cliq.postToChannel("<channel_unique_name>",message);
That's it!
Let us know on the schedulers you've configured to make your worklife easy!
Best,
Manasa
Cliq