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

Examples for Catalyst Type Extension

Have a look at the following few examples with their sample codes in order to better understand catalyst type extensions. The examples featured are :

  • My Notes
  • Url Shortner

My Notes:

My Notes - Notepad is an easy-to-use, intuitive, fast, elegant and secure notepad with cloud syncing. You can use My Notes as a notepad, notebook, journal, agenda or diary. With this extension you can:

  • Use message action to add notes.
  • Use slash commands to view notes.

Here are the sample codes for handlers of MyNotes extension:

Java:

Command handler:


//$Id$
package com.handlers;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.zc.cliq.objects.CommandSuggestion;
import com.zc.cliq.requests.CommandHandlerRequest;
import com.zc.component.object.ZCRowObject;
import com.zc.component.zcql.ZCQL;
public class CommandHandler implements com.zc.cliq.interfaces.CommandHandler {
	@Override
	public Map<string, object=""> executionHandler(CommandHandlerRequest req) throws Exception {
		String text = "";
		Map<string, object=""> resp = new HashMap<string, object="">();
		List<commandsuggestion> suggestions = req.getSelections();
		if (suggestions == null || suggestions.size() == 0) {
			text = "Please select a suggestion from the command"; //NO I18N
		} else {
			CommandSuggestion cmdSuggestion = suggestions.get(0);
			String title = cmdSuggestion.getTitle();
			String query = "SELECT * FROM notes WHERE TITLE=" + title; //NO I18N
			ArrayList<zcrowobject> rows = ZCQL.getInstance().executeQuery(query);
			ZCRowObject row = rows.get(0);
			text = "*Title* : " + row.get("TITLE") + " \n\n*Note* : " + row.get("NOTE"); //NO I18N
		}
		resp.put("text", text);
		return resp;
	}
	@Override
	public List<commandsuggestion> suggestionHandler(CommandHandlerRequest req) throws Exception {
		String userId = req.getUser().getId();
		String query = "SELECT * FROM notes WHERE USER_ID=" + userId; //NO I18N
		ArrayList<zcrowobject> rows = ZCQL.getInstance().executeQuery(query);
		List<commandsuggestion> suggestionList = new ArrayList<commandsuggestion>();
		for (ZCRowObject row : rows) {
			CommandSuggestion suggestion = CommandSuggestion.getInstance((String) row.get("TITLE"), "", "https://i.imgur.com/ereVzNU.png");
			suggestionList.add(suggestion);
		}
		return suggestionList;
	}
}

Function handler:


//$Id$
package com.handlers;
import java.util.Map;
import org.json.JSONObject;
import com.zc.cliq.objects.FormChangeResponse;
import com.zc.cliq.objects.FormDynamicFieldResponse;
import com.zc.cliq.objects.MessageBuilder;
import com.zc.cliq.requests.ButtonFunctionRequest;
import com.zc.cliq.requests.FormFunctionRequest;
import com.zc.cliq.requests.WidgetFunctionRequest;
import com.zc.cliq.util.ZCCliqUtil;
import com.zc.component.object.ZCObject;
import com.zc.component.object.ZCRowObject;
import com.zc.component.object.ZCTable;
public class FunctionHandler implements com.zc.cliq.interfaces.FunctionHandler {
	@Override
	public Map<string, object=""> formSubmitHandler(FormFunctionRequest req) throws Exception {
		JSONObject values = req.getForm().getValues();
		ZCObject zcObj = ZCObject.getInstance();
		ZCTable table = zcObj.getTable("notes"); //NO I18N
		ZCRowObject row = ZCRowObject.getInstance();
		row.set("TITLE", values.get("title")); //NO I18N
		row.set("NOTE", values.get("note")); //NO I18N
		row.set("USER_ID", req.getUser().getId()); //NO I18N
		table.insertRow(row);
		MessageBuilder msg = MessageBuilder.getInstance();
		msg.setText("Note has been saved"); //NO I18N
		return ZCCliqUtil.toMap(msg);
	}
	@Override
	public Map<string, object=""> buttonFunctionHandler(ButtonFunctionRequest req) throws Exception {
		return null;
	}
	@Override
	public FormChangeResponse formChangeHandler(FormFunctionRequest req) throws Exception {
		return null;
	}
	@Override
	public FormDynamicFieldResponse formDynamicFieldHandler(FormFunctionRequest req) throws Exception {
		return null;
	}
	@Override
	public Map<string, object=""> widgetButtonHandler(WidgetFunctionRequest req) throws Exception {
		return null;
	}
}

Message action handler:


//$Id$
package com.handlers;
import java.util.Map;
import com.zc.cliq.enums.FORM_FIELD_TYPE;
import com.zc.cliq.objects.Form;
import com.zc.cliq.objects.FormActionsObject;
import com.zc.cliq.objects.FormInput;
import com.zc.cliq.objects.MessageBuilder;
import com.zc.cliq.requests.MessageActionHandlerRequest;
import com.zc.cliq.util.ZCCliqUtil;
public class MessageActionHandler implements com.zc.cliq.interfaces.MessageActionHandler {
	@Override
	public Map<string, object=""> executionHandler(MessageActionHandlerRequest req) throws Exception {
		String text = "";
		String note = req.getMessage().getText().trim();
		if (note.isEmpty()) {
			text = "Nothing here to add note."; //NO I18N
		} else {
			return getForm(note);
		}
		MessageBuilder resp = MessageBuilder.getInstance();
		resp.setText(text);
		return ZCCliqUtil.toMap(resp);
	}
	private static Map<string, object="">getForm(String notes) {
		Form form = Form.getInstance();
		form.setTitle("Notes"); //NO I18N
		form.setHint("");
		form.setName("notes"); //NO I18N
		form.setButtonLabel("Save Note"); //NO I18N
		form.setVersion(1);
		FormActionsObject actions = FormActionsObject.getInstance();
		actions.setSubmitAction("storeNotes"); //NO I18N
		form.setActions(actions);
		FormInput title = FormInput.getIntance();
		title.setType(FORM_FIELD_TYPE.TEXT);
		title.setName("title"); //NO I18N
		title.setLabel("Title"); //NO I18N
		title.setHint("");
		title.setPlaceholder("Enter the note title"); //NO I18N
		title.setMandatory(true);
		form.addFormInput(title);
		FormInput note = FormInput.getIntance();
		note.setType(FORM_FIELD_TYPE.TEXTAREA);
		note.setName("note"); //NO I18N
		note.setLabel("Note"); //NO I18N
		note.setHint("");
		note.setPlaceholder("");
		note.setMandatory(true);
		note.setValue(notes);
		form.addFormInput(note);
		return ZCCliqUtil.toMap(form);
	}
}

Download full source code (MyNotes - Java)
To try out this extension you can install it from here

Node.js:

Command handler:


'use strict'; // NO I18N
const cliq = require('zcatalyst-integ-cliq'); // NO I18N
const command = cliq.command();
command.executionHandler(async (req, res, app) => {
    let text;
    let suggestions = req.selections;
    if(suggestions === undefined || suggestions.length === 0) {
        text = 'Please select a suggestion from the command'; // NO I18N
    } else {
        let rowId = req.selections[0].id;
        const zcql = app.zcql();
        const query = `SELECT * FROM notes WHERE ROWID=${rowId}`;
        let rows = await zcql.executeZCQLQuery(query);
        let row = rows[0].notes;
        text = "*Title* : " + row.TITLE + " \n\n*Note* : " + row.NOTE; // NO I18N
    }
    res.setText(text);
    return res;
});
command.suggestionHandler(async (req, res, app) => {
        let userId = req.user.id;
        const zcql = app.zcql();
        const query = `SELECT * FROM notes WHERE USER_ID=${userId}`;
        let rows = await zcql.executeZCQLQuery(query);
        for(let row of rows)
        {
            let eachRow = row.notes;
            let suggestion = command.newCommandSugestion();
            suggestion.id = eachRow.ROWID;
            suggestion.title = eachRow.TITLE;
            suggestion.description = '';
            suggestion.imageurl = 'https://i.imgur.com/ereVzNU.png'; // NO I18N
            res.push(suggestion);
        }
        return res;
});

Function handler:


'use strict'; // NO I18N
const Cliq = require('zcatalyst-integ-cliq'); // NO I18N
const functionHandler = Cliq.CliqFunction();
functionHandler.formSubmitHandler(async (req, res, app) => {
    const values = req.form.values;
    const datastore = app.datastore();
    const table = datastore.table("notes"); // NO I18N
    let rowData = {
        TITLE : values.title,
        NOTE : values.note,
        USER_ID : req.user.id
    };
    const newRow = await table.insertRow(rowData);
    res.setText('Note has been saved'); // NO I18N
    return res;
});

Message action handler:


'use strict'; // NO I18N
const Cliq = require('zcatalyst-integ-cliq'); // NO I18N
const messageActionHandler = Cliq.messageAction();
messageActionHandler.executionHandler(async (req, res) => {
    let text = '';
    let note = req.message.text.trim() || "";
    if (note == "") {
        text = "Nothing here to add note."; // NO I18N
    } else {
        return getForm(note);
    }
    res.setText(text);
    return res;
});
function getForm(note) {
    const form = messageActionHandler.newHandlerResponse().newForm();
    form.title = 'Notes'; // NO I18N
    form.hint = '';
    form.name = 'notes';
    form.button_label = 'Save Note'; // NO I18N
    form.version = 1;
    const actions = form.newFormActionsObject();
    actions.submit = actions.newFormAction('storeNotes'); // NO I18N
    form.actions = actions;
    const noteName = form.newFormInput();
    noteName.type = 'text';
    noteName.name = 'title';
    noteName.label = 'Title'; // NO I18N
    noteName.hint = '';
    noteName.placeholder = 'Enter the note title'; // NO I18N
    noteName.mandatory = true;
    form.addInputs(noteName);
    const notes = form.newFormInput();
    notes.type = 'textarea';
    notes.name = 'note';
    notes.label = 'Note'; // NO I18N
    notes.hint = '';
    notes.placeholder = '';
    notes.value = note;
    notes.mandatory = true;
    form.addInputs(notes);
    return form;
}

Download full source code (MyNotes - Node.js)
To try out this extension you can install it from here

The database schema for MyNotes extension:

Url Shortner:

Url Shortner works by transforming any long URL into a shorter, more readable link. With this extension you can shorten links by:

  • passing the link as an argument in a slash command
  • using message action to shorten a URL in a message

Here are the sample codes for handlers of Url Shortner extension

Java:

Command handler:


//$Id$
package com.handlers;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.json.JSONObject;
import com.zc.api.APIConstants.RequestMethod;
import com.zc.api.APIRequest;
import com.zc.cliq.objects.CommandSuggestion;
import com.zc.cliq.requests.CommandHandlerRequest;
public class CommandHandler implements com.zc.cliq.interfaces.CommandHandler {
	@Override
	public Map<string, object=""> executionHandler(CommandHandlerRequest req) throws Exception {
		Map<string, object=""> resp = new HashMap<string, object="">();
		String text = "";
		String url = req.getArguments();
		if (url == null || url == "") {
			text = "Please provide the url along with this command. \nSyntax : /shortenurl <link>)";
		} else {
			try {
				String shortenurl = getShortenedUrl(url);
				text = "Short URL : ```" + shortenurl + "```"; // NO I18N
			} catch (Exception e) {
				text = "Seems to be invalid URL."; // NO I18N
			}
		}
		resp.put("text", text);
		return resp;
	}
	private String getShortenedUrl(String url) throws Exception {
		APIRequest req = new APIRequest();
		req.setUrl("https://cleanuri.com/api/v1/shorten"); // NO I18N
		req.setRequestMethod(RequestMethod.POST);
		HashMap<string, object=""> postData = new HashMap<string, object="">();
		postData.put("url", url);
		req.setPostData(postData);
		req.setAuthNeeded(false);
		JSONObject respJson = new JSONObject(req.getResponse().getResponseJSON().get(0).toString());
		String result_url = respJson.getString("result_url");
		return result_url;
	}
	@Override
	public List<commandsuggestion> suggestionHandler(CommandHandlerRequest req) {
		return new ArrayList<commandsuggestion>();
	}
}

Installation handler:


//$Id$
package com.handlers;
import java.util.logging.Logger;
import com.zc.cliq.enums.STATUS;
import com.zc.cliq.objects.InstallationResponse;
import com.zc.cliq.requests.InstallationRequest;
public class InstallationHandler implements com.zc.cliq.interfaces.InstallationHandler {
	@Override
	public InstallationResponse handleInstallation(InstallationRequest arg0) throws Exception {
		InstallationResponse resp = InstallationResponse.getInstance();
		resp.setStatus(STATUS.SUCCESS);
		return resp;
	}
}

Installation validator:


//$Id$
package com.handlers;
import java.util.logging.Logger;
import com.zc.cliq.enums.STATUS;
import com.zc.cliq.objects.InstallationResponse;
import com.zc.cliq.requests.InstallationRequest;
public class InstallationValidator implements com.zc.cliq.interfaces.InstallationValidator {
	@Override
	public InstallationResponse validateInstallation(InstallationRequest req) throws Exception {
		InstallationResponse resp = InstallationResponse.getInstance();
		resp.setStatus(STATUS.SUCCESS);
		return resp;
	}
}

Message action Handler:


//$Id$
package com.handlers;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.zc.api.APIRequest;
import com.zc.api.APIConstants.RequestMethod;
import com.zc.cliq.requests.MessageActionHandlerRequest;
import org.json.JSONObject;
public class MessageActionHandler implements com.zc.cliq.interfaces.MessageActionHandler {
	@Override
	public Map<string, object=""> executionHandler(MessageActionHandlerRequest req) throws Exception {
		Map<string, object=""> resp = new HashMap<string, object="">();
		String url = req.getMessage().getText();
		String text = "";
		if (url == null || url == "") {
			text = "It's empty"; // NO I18N
		} else {
			try {
				String shortenurl = getShortenedUrl(url);
				text = "Short URL : ```" + shortenurl + "```"; // NO I18N
			} catch (Exception e) {
				text = "Seems to be invalid URL."; // NO I18N
			}
		}
		resp.put("text", text);
		return resp;
	}
	private String getShortenedUrl(String url) throws Exception {
		APIRequest req = new APIRequest();
		req.setUrl("https://cleanuri.com/api/v1/shorten"); // NO I18N
		req.setRequestMethod(RequestMethod.POST);
		HashMap<string, object=""> postData = new HashMap<string, object="">();
		postData.put("url", url);
		req.setPostData(postData);
		req.setAuthNeeded(false);
		JSONObject respJson = new JSONObject(req.getResponse().getResponseJSON().get(0).toString());
		String result_url = respJson.getString("result_url");
		return result_url;
	}
}
,>,>,>,>,>

Download full source code (Url Shortner - Java).
To try out this extension you can install it from here.

Node.js:

Command handler:


'use strict'; //NO I18N
const cliq = require('zcatalyst-integ-cliq'); //NO I18N
const axios = require('axios'); //NO I18N
const command = cliq.command();
command.executionHandler(async(req, res) => {
    let text = "";
    let url = req.arguments.trim() || "";
    if (url === "") {
        text = "Please provide the url along with this command. \nSyntax : /shortenurl <$link>";
    } else {
        text = await getShortenedUrl(url);
    }
    res.setText(text);
    return res;
});
async function getShortenedUrl(url) {
    try {
        let response = await axios.post('https://cleanuri.com/api/v1/shorten', { //NO I18N
            url: url
        });
        return "Short URL : ```" + response.data.result_url + "```"; //NO I18N
    } catch (e) {
        return "Seems to be invalid URL."; //NO I18N
    }
}

Message action Handler


'use strict'; //NO I18N
const cliq = require('zcatalyst-integ-cliq'); //NO I18N
const axios = require('axios'); //NO I18N
const messageActionHandler = cliq.messageAction();
messageActionHandler.executionHandler(async(req, res) => {
    let text = "";
    let url = req.message.text.trim() || "";
    if (url === "") {
        text = "It's empty"; //NO I18N
    } else {
        text = await getShortenedUrl(url);
    }
    res.setText(text);
    return res;
});
async function getShortenedUrl(url) {
    try {
        let response = await axios.post('https://cleanuri.com/api/v1/shorten', { //NO I18N
            url: url
        });
        return "Short URL : ```" + response.data.result_url + "```"; //NO I18N
    } catch (e) {
        return "Seems to be invalid URL."; //NO I18N
    }
}

Download full source code (Url Shortner - Node.js).
To try out this extension you can install it from here.