Skip to product menu
close
  • Recent Launches
    Press Space or Enter to display list of options
EXPLORE ALL PRODUCTS

Recent Launches

New

Payroll software with automated tax payments and filing.

Try now
New

Robotic process automation software to automate high-volume, rule-based tasks.

Try for free
New

Low-code IoT platform and solutions for connected businesses.

Try now
New

Business formation service to launch and grow your businesses.

Try now
New

Privacy-friendly application analytics solution.

Try for free

Sales

 
CRM

Comprehensive CRM platform for customer-facing teams.

CRM
 
Bigin

Simple CRM for small businesses moving from spreadsheets.

Bigin
 
Forms

Build online forms for every business need.

Forms
 
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
 
Bookings

Appointment scheduling app for consultations with customers.

Bookings
 
Sign

Digital signature app for businesses.

Sign
 
RouteIQ

Comprehensive sales map visualization and optimal route planning solution.

RouteIQ
 
Thrive

Complete loyalty and affiliate management platform.

Thrive
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
Suites
CRM Plus

Unified platform to deliver top-notch customer experience.

CRM Plus

Marketing

 
Social

All-in-one social media management software.

Social
 
Campaigns

Create, send, and track targeted email campaigns that drive sales.

Campaigns
 
Forms

Build online forms for every business need.

Forms
 
Survey

Design surveys to reach and interact with your audience.

Survey
 
Sites

Online website builder with extensive customisation options.

Sites
 
PageSense

Website conversion optimization and personalisation platform.

PageSense
 
Backstage

End-to-end event management software.

Backstage
 
Webinar

Webinar platform for webcasting online webinars.

Webinar
 
Marketing Automation

All-in-one marketing automation software.

Marketing Automation
 
LandingPage

Smart landing page builder to increase conversion rates

LandingPage
 
Publish

Manage all your local business listings on a single platform.

Publish
 
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
 
Sign

Digital signature app for businesses.

Sign
 
Thrive

Complete loyalty and affiliate management platform.

Thrive
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
NEW
LeadChain

Sync, manage, and convert leads across channels seamlessly.

LeadChain
 
NEW
CommunitySpaces

Online community platform for individuals and businesses to grow their network and brand.

CommunitySpaces
 
Suites
Marketing Plus

Unified marketing platform for marketing teams.

Marketing Plus

Commerce and POS

 
Commerce

eCommerce platform to manage and market your online store.

Commerce

Service

 
Desk

Helpdesk software to deliver great customer support.

Desk
 
Assist

Remote support and unattended remote access software.

Assist
 
Lens

Interactive remote assistance software with augmented reality.

Lens
 
FSM

End-to-end field service management platform for service businesses.

FSM
 
SalesIQ

Live chat app to engage and convert website visitors.

SalesIQ
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
NEW
Solo

The all-in-one toolkit for solopreneurs.

Solo
 
Bookings

Appointment scheduling app for consultations with customers.

Bookings
 
Suites
Service Plus

Unified platform for customer service and support teams.

Service Plus

Finance

 
Books

Powerful accounting platform for growing businesses.

Books
 
FREE
Invoice

100% Free invoicing solution.

Invoice
 
Expense

Effortless expense reporting platform.

Expense
 
Inventory

Powerful stock management and inventory control software.

Inventory
 
Billing

End-to-end billing solution for your business.

Billing
 
Checkout

Collect payments online with custom branded pages.

Checkout
 
NEW
Payroll

Payroll software with automated tax payments and filing.

Payroll
 
NEW
Solo

The all-in-one toolkit for solopreneurs.

Solo
 
Practice

Practice management software for accounting firms.

Practice
 
Sign

Digital signature app for businesses.

Sign
 
Commerce

eCommerce platform to manage and market your online store.

Commerce
 
Suites
Finance Plus

All-in-one suite to manage your operations and finances.

Finance Plus

Email and Collaboration

 
Mail

Secure email service for teams of all sizes.

Mail
 
Meeting

Online meeting software for all your video conferencing & webinar needs.

Meeting
 
Writer

Word processor for focused writing and discussions.

Writer
 
Sheet

Spreadsheet software for collaborative teams.

Sheet
 
Show

Create, edit, and share slides with a sleek presentation app.

Show
 
Notebook

Beautiful home for all your notes.

Notebook
 
Cliq

Stay in touch with teams no matter where you are.

Cliq
 
Connect

Employee experience platform to communicate, engage, and build positive employee relations.

Connect
 
Bookings

Appointment scheduling app for consultations with customers.

Bookings
 
TeamInbox

Shared inboxes for teams.

TeamInbox
 
WorkDrive

Online file management for teams.

WorkDrive
 
Sign

Digital signature app for businesses.

Sign
 
Office Suite

Powerful collaborative work platform for teams.

Office Suite
 
Office Integrator

Built in document editors for web apps.

Office Integrator
 
ZeptoMail

Secure and reliable transactional email sending service.

ZeptoMail
 
Calendar

Online business calendar to manage events and schedule appointments.

Calendar
 
Learn

Knowledge and learning management platform.

Learn
 
Voice

Cloud Contact Center Software for businesses.

Voice
 
ToDo

Collaborative task management for individuals and teams.

ToDo
 
Tables

Work management tool to connect people, processes, and information.

Tables
 
FREE
PDF Editor

Collaborative online PDF editing tool.

PDF Editor
 
Suites
Workplace

Application suite built to improve team productivity and collaboration.

Workplace

Human Resources

 
People

Organize, automate, and simplify your HR processes.

People
 
Recruit

Intuitive recruiting platform built to provide hiring solutions.

Recruit
 
Expense

Effortless expense reporting platform.

Expense
 
Workerly

Manage temporary staffing with an employee scheduling solution.

Workerly
 
NEW
Payroll

Payroll software with automated tax payments and filing.

Payroll
 
Shifts

Employee scheduling and time tracking app.

Shifts
 
Sign

Digital signature app for businesses.

Sign
 
Suites
People Plus

Comprehensive HR platform for seamless employee experiences.

People Plus

Security and IT Management

 
Creator

Build custom apps to simplify business processes.

Creator
 
Directory

Workforce identity and access management solution for cloud businesses.

Directory
 
FREE
OneAuth

Secure multi-factor authenticator (MFA) for all your online accounts.

OneAuth
 
Vault

Online password manager for teams.

Vault
 
Catalyst

Pro-code platform to build and deploy your apps.

Catalyst
 
Toolkit

Complete resource for any admin-related lookup queries.

Toolkit
 
Lens

Interactive remote assistance software with augmented reality.

Lens
 
Assist

Remote support and unattended remote access software.

Assist
 
QEngine

Test automation software to build, manage, execute, and report testcases.

QEngine
 
NEW
RPA

Automate manual, tedious, and repetitive tasks easily.

RPA

BI and Analytics

 
Analytics

Modern self-service BI and analytics platform.

Analytics
 
Embedded BI

Embedded analytics and white label BI solutions, tailored for your needs.

Embedded BI
 
DataPrep

AI-powered data preparation service for your data-driven organization.

DataPrep
 
NEW
IoT

Harnessing IoT analytics for real-time operational intelligence.

IoT

Project Management

 
Projects

Manage, track, and collaborate on projects with teams.

Projects
 
Sprints

Planning and tracking tool for scrum teams.

Sprints
 
BugTracker

Automatic bug tracking software for managing bugs.

BugTracker
 
NEW
Solo

The all-in-one toolkit for solopreneurs.

Solo

Developer Platforms

 
Creator

Build custom apps to simplify business processes.

Creator
 
Flow

Automate business workflows by creating smart integrations.

Flow
 
Catalyst

Pro-code platform to build and deploy your apps.

Catalyst
 
Office Integrator

Built in document editors for web apps.

Office Integrator
 
ZeptoMail

Secure and reliable transactional email sending service.

ZeptoMail
 
QEngine

Test automation software to build, manage, execute, and report testcases.

QEngine
 
Tables

Work management tool to connect people, processes, and information.

Tables
 
NEW
RPA

Automate manual, tedious, and repetitive tasks easily.

RPA
 
NEW
Apptics

Application analytics for all apps.

Apptics
 
Embedded BI

Embedded analytics and white label BI solutions, tailored for your needs.

Embedded BI
 
NEW
IoT

Build, deploy, and scale IoT solutions for connected businesses.

IoT
 
DataPrep

AI-powered data preparation service for your data-driven organization.

DataPrep

IoT

 
NEW
IoT

Low-code IoT platform and solutions for connected businesses.

IoT

Search Result

 
CRM Plus

Unified platform to deliver top-notch customer experience.

Try now
CRM Plus
 
Service Plus

Unified platform for customer service and support teams.

Try now
Service Plus
 
Finance Plus

All-in-one suite to manage your operations and finances.

Try now
Finance Plus
 
People Plus

Comprehensive HR platform for seamless employee experiences.

Try now
People Plus
 
Workplace

Application suite built to improve team productivity and collaboration.

Try now
Workplace
 
Marketing Plus

Unified marketing platform for marketing teams.

Try now
Marketing Plus
 
All-in-one suite

Zoho One

The Operating System for Business

Run your entire business on Zoho with our unified cloud software, designed to help you break down silos between departments and increase organizational efficiency.

TRY ZOHO ONE
Zoho One
Zoho Marketplace

With over 2000 ready-to-use extensions across 40+ categories, connect your favorite business tools with the Zoho products you already use.

EXPLORE MARKETPLACE
Marketplace
Skip to main content

 

Invoke URL task

An Invoke URL task is used to access third party services from Cliq through Connections. The Invoke URL task supports four HTTP methods, GET, POST, PUT, DELETE.

Sample Invoke URL task

response=invokeUrl                    
[
*url: <url>
*type: <GET/PUT/POST/DELETE>
parameters: <parameters>        
headers: <headers>             
connection: <connection name>  
files: <file object>            
]; 
//All mandatory parameters are marked with an *

 

A list of parameters is passed when the invoke URL task is executed. They are explained in this table. 

ParametersDescriptionRequisite
urlThe resource URL from the third party service used to perform various operations.Mandatory
typeHTTP Methods: GET | PUT | POST | DELETEMandatory
parametersTo send additional params of the form data type in the request URL. Optional
headersHeaders are used to specify the request header parameters.Optional
connectionThe name of the connection to be used.Optional
filesThe file object.Optional

How to use the invoke URL task 

Let us consider an integration between Cliq and Google Drive, wherein you'll be able to pull files from Google drive straight into Cliq. For this integration to work, start by creating a connection with Google Drive.

  1. Create the connection by choosing Google Drive from the pre-registered service. 
  2. Give a Connection Name and configure the Use Credentials of Login User option according to your requirement. If the option is enabled, it will work with every user's authentication and in case the option is not enabled, the connection will use the admin (connection owner) authentication.
  3. Upon creating the connection, an invoke URL task will be generated. 
  4. Now, create a /gdrive command in Cliq.
  5. The invoke URL deluge script should be used in the command execution code to let you pull files from Google Drive. 

The Google Drive resource URL that lets you get your Gdrive files is given below. Refer Google Drive API references for more information.


https://www.googleapis.com/drive/v3/files

 

Take a look at the sample invoke URL deluge script for connecting to Google Drive. The following deluge script, when executed will pull your Google Drive files directly into Cliq. 


response=invokeurl
[
	url :"https://www.googleapis.com/drive/v3/files"
	type :GET
	parameters:params
	connection: //Enter your connection name
];

 

The params and their description are given below

  • url: Provide the get Google Drive files API
  • type: The HTTP method for this request is GET
  • connection: Give the connection name. Use credentials of login user (checkbox): Enabling this option will ask permission from the user to access their Google Drive account; which means — the connection will work with the user's authentication. In case this checkbox is disabled, the connection will work with the connection owner (creator) authentication. 

Note:

First time authentication —The first time the /gdrive command is triggered, the invoke URL task is executed and the user is prompted to provide access to pull the files on their behalf and on giving access, the files are directly pulled into the user's Cliq account. 

/gdrive Command

Let us now put the invoke URL task to use in a command's execution code. The /gdrive command can be used to pull files from the user's google drive directly into Cliq. The file to be pulled is given as arguments during command execution. Refer the command execution handler to understand more. 



    //User can pass search keyword as arguments along with the command
    searchKeyword = arguments;
    messageTitle = "Files in your drive";
    if(!searchKeyword.isNull()) {
        messageTitle = "Files in your drive for search *" + searchKeyword + "*";
    }
    //Invoking Google drive's API
    params = Map();
    params.put("q","name contains '" + searchKeyword + "' and 'me' in owners");
    params.put("pageSize","10");
    params.put("restrictToMyDrive","true");
    params.put("fields","*");
    response = invokeurl
    [
        url :"https://www.googleapis.com/drive/v3/files"
        type :GET
        parameters:params
        connection:"gdrive"
    ];
    info response;
    files = response.get("files");
    list = List();
    //Formatting the files response to post as message
    for each  file in files
    {
        if(file.get("trashed"))
        {
            continue;
        }
        label = file.get("name").trim();
        if(file.containsKey("webContentLink"))
        {
            label = "[" + file.get("name").trim() + "](" + file.get("webContentLink") + ")";
        }
        else if(file.containsKey("webViewLink"))
        {
            label = "[" + file.get("name").trim() + "](" + file.get("webViewLink") + ")";
        }
        list.add(label);
    }
    response = Map();
    slidesList = list();
    slidesList0 = Map();
    slidesList0.put("type","list");
    slidesList0.put("data",list);
    slidesList.add(slidesList0);
    response.put("slides",slidesList);
    response.put("text",messageTitle);
    // Return the response to the user
    return response;
    

 

Take a look at the GIF below to understand how the /gdrive command is executed to pull files directly from your Google Drive. 

/gdrive command execution

Apart from the mandatory parameters, there are a few additional parameters that can be used in the invoke URL task. 

How to use the headers parameter in the invoke URL task 

Headers in REST

HTTP Headers are an important part of an API request and the corresponding response. They represent the metadata associated with the API request and response for the following

  • API request and Response body
  • Authorization Requests
  • Response Caching 
  • Response Cookies

Some of the most common headers that needs to be passed with an API request are:

  • Authorization: Authentication credentials for the resource being requested
  • Content-Type: Indicates the media type of the resource

Message Action - Upload files to Google Drive

Take for example, a message action to upload files shared in Cliq directly to your Google Drive account. For this integration to work, create an integration with Google Drive. The google drive resource URI for uploading files is given below. Refer Drive API references for more information

​
https://www.googleapis.com/upload/drive/v3/files

 

A sample invoke URL deluge script for the Google Drive connection is shown below.

​
response = invokeUrl [
    url : "https://www.googleapis.com/upload/drive/v3/files"
    type : POST
    headers : gDriveHeaders
    files : gDriveFiles
    connection : // Give your connection name
];

 

The task parameters and their description are:

  • url: Give the google drive API to send attachments/ upload files.
  • type: Specify the HTTP method - POST
  • connection: Give the connection name. This connection has the use credentials of login user (user access value) set as true. When this code is executed, the user will be prompted to give access and perform integration with their own credentials.
  • headers: Specify the request headers to be passed. headers is of the data type MAP. 
  • files: The files object of the data type LIST is used to store the list of files.  

Uploading a file in Cliq to Google Drive

Add a file shared in chat directly to your GDrive account through the upload file message action. 



message = Map();
file = attachments.get(0);
params = Map();
params.put("name",file);
comments = Map();
comments.put("stringPart","true");
comments.put("paramName","metadata");
comments.put("content",params.toString());
comments.put("contentType","application/json");
comments.put("encodingType","UTF-8");
fileList = List();
fileList.add(comments);
fileList.add(file);
driveHeaders = Map();
driveHeaders.put("Content-Type","multipart/related");
response = invokeurl
[
	url :"https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart"
	type :POST
	headers:driveHeaders
	files:fileList
	connection: //Give your connection name
];
info response;
fileDetails = invokeurl
[
	url :"https://www.googleapis.com/drive/v3/files/" + encodeUrl(response.get("id")) + "?fields=name,id,webViewLink&restrictToMyDrive=true"
	type :GET
	connection: //Give your connection name
];
button = List();
if(!fileDetails.get("webViewLink").isNull())
{
	button.add({"label":"View","action":{"type":"open.url","data":{"web":fileDetails.get("webViewLink")}},"type":"+"});
}
message = {"text":"The file [" + response.get("name") + "]("+fileDetails.get("webViewLink")+") has been uploaded to your Google Drive. :thumbsup:"};
return message;

How to use the files parameter in the invoke URL task 

As an example let us again consider a message action - to upload files shared in chat directly to your Zoho Docs. The Zoho Docs resource URL to upload files is shown below. Refer Zoho Docs upload file API for more details about the query string parameters required


https://apidocs.zoho.com/files/v1/upload

 

To create a connection with Zoho Docs, follow the below given steps:

  1. Choose Zoho under the pick your service section in the Connections page
  2. Give your connection name and under scopes — select ZohoPC/docsapi 
  3. Click on Create and Connect to create the connection with Zoho Docs

A sample invoke URL deluge script for the Zoho Docs connection with the file upload API is shown below.

​
response = invokeurl
[
	url :"https://apidocs.zoho.com/files/v1/upload"
	type :POST
	files: fileslist
	connection: //Give your connection name
];
  • url: Give the Zoho Docs api to send attachments/ upload files.
  • type: Specify the HTTP method - POST
  • connection: Give the connection name. This connection has the use credentials of login user (user access value) set as true. When this code is executed, the user will be prompted to give access and perform integration with their own credentials. headers: Specify the request headers to be passed. 
  • files : The files object of the data type LIST is used to store the list of files.  

Uploading a file in Cliq to Zoho Docs

Add a file shared in chat directly to your Zoho Docs account through the Upload to ZDocs message action.


output = Map();
docsparams = Map();
att = attachments.get(0);
docsparams.put("stringPart","true");
docsparams.put("paramName","filename");
docsparams.put("content","" + att);
fileslist = List();
fileslist.add(docsparams);
att.setParamName("content");
fileslist.add(att);
response = invokeurl
[
	url :"https://apidocs.zoho.com/files/v1/upload"
	type :POST
	files:fileslist
	connection: //Give your connection name
];
info response;
result = response.get("response").toList().get(2).toList();
info result;
docid = result.toMap().get("result").toList().get(1).toMap().get("uploaddocid");
output.put("text","Uploaded to your ZOHO Docs! (y) [View in Docs](https://docs.zoho.com/file/" + docid + ")");
return output;

Using the parameters attribute in the invoke URL task

The parameters attribute of the datatype MAP can be used in the invoke URL task when an API requires you to send additional data in the request body. Let us take an example of a weekly scheduler that brings the list of major open issues in a project. The resource URL to get the list of issues from a project is given below. Refer Zoho Projects API guide for more details. 


https://projectsapi.zoho.com/restapi/portal/[PORTAL ID]/projects/[PROJECT ID]/bugs/

 

The first step would be to create a connection with Zoho Projects and generate the invoke URL task. The steps to create a connection with Zoho Projects is given below

  1. Choose Zoho under the pick your service section in the Connections page
  2. Give your connection name and under scopes — select ZohoProjects/projectsapi
  3. Click on Create and Connect to create the connection with Zoho Docs

A sample invoke URL deluge script for the Zoho Projects connection with the Get all issues API is shown below.


getissues = invokeurl
[
	url :"https://projectsapi.zoho.com/restapi/portal/[PORTAL ID]/projects/[PROJECT ID]/bugs/"
	type :GET
	parameters: paramsMap
	connection: //Give your connection name
];

 

The params and their description are given below

  • url: Provide the get all issues/bugs API
  • type: The HTTP method for this request is GET
  • connection: Give the connection name. Use credentials of login user (checkbox): Enabling this option will ask permission from the user to access their Google Drive account; which means — the connection will work with the user's authentication. In case this checkbox is disabled, the connection will work with the connection owner (creator) authentication. 
  • parameters : A map containing all the request parameters. 

Note:

In cases where the API does not accept form encoded input, the data has to be sent as JSON in the request body. You can use the .toString() function to stringify the parameters. 

The issues scheduler scipt is shown below. This scheduler will be triggered every week to pull the list of recently filed open issues with severity marked as Major and post it in a channel. 


paramsMap = Map();
paramsMap.put("statustype","open");
paramsMap.put("severity",{"Provide the severity ID"});
paramsMap.put("index",0);
paramsMap.put("range","5");
paramsMap.put("sort_order","ascending");
getissues = invokeurl
[
	url :"https://projectsapi.zoho.com/restapi/portal/[PORTAL ID]/projects/[PROJECT ID]/bugs/"
	type :GET
	parameters:paramsMap
	connection: //Give your connection name
];
info getissues;
bugs = getissues.toMap().get("bugs");
info bugs.size();
rows = List();
for each  bug in bugs
{
	row = Map();
	row.put("Issue Title",bug.get("title"));
	row.put("Issue ID",bug.get("bug_number"));
	row.put("Severity",bug.get("severity").toMap().get("type"));
	rows.add(row);
}
message = {"text":"List of Major issues pending this week.","card":{"theme":"modern-inline","title":"Issue List:"},"bot":{"name":"Team Bot","image":""},"slides":{{"type":"table","title":"","data":{"headers":{"Issue Title","Issue ID","Severity"},"rows":rows}}}};
info zoho.cliq.postToChannel(channel_unqiue_name,message);

 

Related Articles:

Connections: How to integrate Cliq with third party applications?

Learn how to connect external applications to Cliq using Connections