# Java -------------------------------------------------------------------------------- title: "Introduction" description: "Create an Event Driven Architecture to automate invoice updates from Zoho Books to Zoho Cliq using Event Functions and Catalyst Signals." last_updated: "2026-03-18T07:41:08.680Z" source: "https://docs.catalyst.zoho.com/en/tutorials/invoice-notifier/java/introduction/" service: "All Services" related: - Project Directory Structure (/en/cli/v1/project-directory-structure/introduction/) - Java SDK (/en/sdk/java/v1/overview/) - Node.js SDK (/en/sdk/nodejs/v2/overview/) - Python SDK (/en/sdk/python/v1/overview/) -------------------------------------------------------------------------------- # Invoice Notifier ### Introduction In a fast-paced business environment, timely customer onboarding plays a key role in ensuring customer satisfaction. However, Customer Success teams often face delays due to a lack of real-time payment updates from billing applications. This tutorial demonstrates how you can use **Catalyst Signals** to bridge this gap and automate communication between decoupled systems. You will build an event-driven solution that listens to invoice updates from {{%link href="https://www.zoho.com/in/books/" %}}**Zoho Books**{{%/link%}}, filters the events based on payment status, and compiles a summary of paid invoices every hour. This summary will then be sent to a {{%link href="https://docs.catalyst.zoho.com/en/serverless/help/functions/event-functions/" %}}**Catalyst Event Function**{{%/link%}}, which will forward the report to your {{%link href="https://www.zoho.com/cliq/"%}}**Zoho Cliq**{{%/link%}} channel. The event automation uses components from the following Catalyst Services: {{%link href="/en/signals" %}}**Catalyst Signals**{{%/link%}}: * {{%link href="/en/signals/help/publishers/key-aspects/" %}}**Publisher**{{%/link%}}: A primary source of {{%link href="/en/signals/help/events/" %}}events{{%/link%}} where they are generated when any action or change occurs in an application. * {{%link href="/en/signals/help/rules/key-aspects/" %}}**Rules**{{%/link%}}: It is a statement that guides the ingestion of incoming events from Publisher to {{%link href="/en/signals/help/targets/key-aspects/" %}}Target{{%/link%}}. {{%link href="/en/serverless/" %}}**Catalyst Serverless**{{%/link%}}: * {{%link href="/en/serverless/help/functions/event-functions/" %}}**Event Function**{{%/link%}}: It is an asynchronous task function that is associated with Catalyst Signals. An Event function is created to execute a task or a set of tasks on the occurrence of a specified event. We will use the {{%link href="https://console.catalyst.zoho.com/" %}}Catalyst web console{{%/link%}} and the {{%link href="/en/cli/v1/cli-command-reference/" %}}Catalyst Command Line Interface{{%/link%}} (CLI) to build this application. You will be given the code for the files to be included in the function components in this tutorial. You will just need to copy the code given here and paste it into the appropriate files as directed. ### Event Flow The architecture of the event flow in this use case is outlined below: - A customer makes a payment, **triggering an invoice update** in Zoho Books. This event is published to Catalyst Signals. - Signals applies a **filter** to include only invoices marked as *Paid*. The filtered event data is then transformed and batched. - **Every hour**, the **batched events** are delivered to a Catalyst Event Function. The function further processes the event data and sends as a **report to a Zoho Cliq channel**. <br /> -------------------------------------------------------------------------------- title: "Prerequisites" description: "Create an Event Driven Architecture to automate invoice updates from Zoho Books to Zoho Cliq using Event Functions and Catalyst Signals." last_updated: "2026-03-18T07:41:08.681Z" source: "https://docs.catalyst.zoho.com/en/tutorials/invoice-notifier/java/prerequisites/" service: "All Services" related: - CLI Command Reference (/en/cli/v1/cli-command-reference/) - Install CLI (/en/getting-started/installing-catalyst-cli/) - Login CLI (/en/cli/v1/login/login-from-cli/) - Zoho Books Organization Profile (https://www.zoho.com/in/books/help/settings/organization-profile.html) - Zoho Cliq Channels (https://www.zoho.com/cliq/help/channels/create-channel.html) - Zoho Cliq Bots (https://www.zoho.com/cliq/help/platform/managing-bots.html) -------------------------------------------------------------------------------- # Prerequisites Before you begin building the Invoice Notifier, you must have the following prerequisites installed on your system: ### 1. Catalyst CLI Catalyst CLI contains a host of tools that enable you to initialize, develop, test, and deploy the components of your application from your local machine. We will be working with Catalyst CLI in this tutorial. You must perform the following actions: 1. {{%bold%}}Install Catalyst CLI:{{%/bold%}} Catalyst CLI is installed through NPM so you must have both NPM and Node.js installed beforehand. Refer to the {{%link href="/en/getting-started/installing-catalyst-cli/" %}}**Install Catalyst CLI help page**{{%/link%}} for details on the pre-requisites and the steps to install it. 2. {{%bold%}}Login Catalyst CLI:{{%/bold%}} After installation, you must authenticate the CLI with your Catalyst account before using it. Refer to the {{%link href="/en/cli/v1/login/login-from-cli/" %}}**CLI Login help page**{{%/link%}} for the steps to login from Catalyst CLI and the various options available for it. ### 2. Any IDE tool for Node.js and client code development Use any IDE that supports Java development like Visual Studio Code, IntelliJ, or Eclipse to work on the event function. {{%info image="/images/tutorials/todo-list/vscode.png"%}}If you are a Visual Studio Code IDE user, you can install the {{%bold%}}Catalyst Tools{{%/bold%}} extension, and use your IDE itself in place of the CLI. You can find more details about the Catalyst VS Code extension from this {{%link href="/en/catalyst-extensions/vs-code-extension/introduction/" %}}help section{{%/link%}}.{{%/info%}} ### 3. Zoho Books for Invoice Management Create an organization in {{%link href="https://www.zoho.com/in/books/" %}}Zoho Books{{%/link%}} to maintain customer payment records in the form of invoices. {{%note%}}{{%bold%}}Note:{{%/bold%}} You can also integrate any third-party tools for invoice generation. However, if you choose to do so, you will need to configure a {{%link href="/en/signals/help/publishers/create-publisher/custom-publishers" %}}{{%bold%}}custom publisher{{%/bold%}}{{%/link%}} {{%bold%}}in Catalyst Signals{{%/bold%}} for the external application and update the rule accordingly.{{%/note%}} ### 4. Zoho Cliq for Team Notifications Create an organization in {{%link href="https://www.zoho.com/cliq/" %}}Zoho Cliq{{%/link%}} to act as internal communication platform for your Customer Success Team. Within this organization, - Create a Channel for updating invoice status of onboarding customers. Follow the steps given in the {{%link href="https://help.zoho.com/portal/en/kb/zoho-cliq/user-guides/channels/channel-actions/articles/how-do-i-create-a-channel" %}}How to create a channel in Zoho Cliq{{%/link%}} help page for guidance. - Create and associate a bot to the channel so it can automatically post messages regarding the invoice updates. Refer to the {{%link href="https://www.zoho.com/cliq/help/platform/managing-bots.html" %}}Managing Bots{{%/link%}} and {{%link href="https://www.zoho.com/cliq/help/platform/bot-participation-handler.html" %}}Bot Channel Participation{{%/link%}} help resources for guidance. For this tutorial, you don’t need to add or edit any handlers for the bot. Ensure that the required channel participation permissions are configured correctly while creating the bot, as shown in the image below. {{%note%}}{{%bold%}}Note:{{%/bold%}} You can also integrate any third-party tools for internal team communication. However, if you choose to do so, you will need to {{%bold%}}update the event function{{%/bold%}} accordingly to route notifications to the appropriate communication channel.{{%/note%}} -------------------------------------------------------------------------------- title: "Create a Project" description: "Create an Event Driven Architecture to automate invoice updates from Zoho Books to Zoho Cliq using Event Functions and Catalyst Signals." last_updated: "2026-03-18T07:41:08.681Z" source: "https://docs.catalyst.zoho.com/en/tutorials/invoice-notifier/java/create-project/" service: "All Services" related: - Catalyst Console (/en/getting-started/catalyst-projects/) -------------------------------------------------------------------------------- # Create a Project Let’s {{%link href="/en/getting-started/catalyst-projects/#creating-a-catalyst-project" %}}create a Catalyst project{{%/link%}} from the Catalyst console. 1. Log in to the {{%link href="https://console.catalyst.zoho.com/baas/index" %}}Catalyst console{{%/link%}} and click **Create New Project**. <br /> 2. Enter the project’s name as "**InvoiceNotifier**" in the pop-up window, and click **Create**. <br /> Your project will be created then opened. You can access the project later, by clicking **Access Project**. -------------------------------------------------------------------------------- title: "Add Publisher" description: "Create an Event Driven Architecture to automate invoice updates from Zoho Books to Zoho Cliq using Event Functions and Catalyst Signals." last_updated: "2026-03-18T07:41:08.681Z" source: "https://docs.catalyst.zoho.com/en/tutorials/invoice-notifier/java/configure-publisher/" service: "All Services" related: - Publishers (/en/signals/help/publishers/key-aspects/) -------------------------------------------------------------------------------- # Add Publisher Let us start by setting up a {{%link href="/en/signals/help/publishers/key-aspects/" %}}**Publisher**{{%/link%}} in the *InvoiceNotifier* project. This Publisher will listen for **Invoice Updated** events from {{%link href="https://www.zoho.com/in/books/" %}}**Zoho Books**{{%/link%}} and forward them to {{%link href="/en/signals" %}}**Catalyst Signals**{{%/link%}}. Follow these steps to configure the Publisher: 1. Navigate to the **Catalyst Signals** section in the Catalyst Console and click **Start Exploring**. <br /> 2. Go to **Publishers** and click **Create Publisher**. <br /> 3. From the list of available Zoho Services, select **Zoho Books**. <br /> 4. You will be taken to a configuration page. Fill in the required details: - Set the **Publisher Name** and **API Name** as Zylker. - Select the desired Zoho Books org from the **Organization** dropdown. It will list only the organizations linked to the same email address you use to access the Catalyst Console. <br /> 5. Enable **Event Ordering** to ensure that events are delivered in the same order they are received. <br /> 6. Click **Save** to complete Setup and **Authorize** to use data from Zoho Books. <br /> Your Zoho Books Publisher is now ready to send invoice events to Catalyst Signals. -------------------------------------------------------------------------------- title: "Initialize the Project from CLI" description: "Create an Event Driven Architecture to automate invoice updates from Zoho Books to Zoho Cliq using Event Functions and Catalyst Signals." last_updated: "2026-03-18T07:41:08.683Z" source: "https://docs.catalyst.zoho.com/en/tutorials/invoice-notifier/java/initialize-project/" service: "All Services" related: - Initialize CLI Resources (/en/cli/v1/initialize-resources/introduction/) - Project Directory Structure (/en/cli/v1/project-directory-structure/introduction/) -------------------------------------------------------------------------------- # Initialize the Project from the CLI You can now begin working on your Catalyst project from the CLI. The first step is to initialize the project in an empty directory. This will be the home directory of your project and all of the project files will be saved in it. You can learn more about this from the {{%link href="/en/cli/v1/project-directory-structure/introduction/" %}}Project Directory Structure help page{{%/link%}}. You can learn about initializing a project in detail from the {{%link href="/en/cli/v1/initialize-resources/introduction/" %}}CLI help documentation{{%/link%}}. For this InvoiceNotifier, we will initialize an {{%link href="/en/serverless/help/functions/event-functions/" %}}Event Function{{%/link%}}, which will contain the logic of the action that is required to occur once the event happens and a {{%link href="/en/cli/v1/initialize-resources/initialize-client/#basic-client-applications" %}}Basic web app{{%/link%}} as the client component. The event function will be initialized in the {{%link href="/en/sdk/java/v1/overview/" %}}Java{{%/link%}} platform. However, you can also initialize it in the {{%link href="/en/sdk/nodejs/v2/overview/" %}}Node JS{{%/link%}} or {{%link href="/en/sdk/python/v1/overview/" %}}Python{{%/link%}} platforms. {{%note%}}{{%bold%}}Note:{{%/bold%}} Ensure that you enter the function's package name or class name exactly as instructed, because the application's code contains the same name.{{%/note%}} 1. Create a folder for the project on your local machine and navigate to it from the terminal. 2. Initialize a project by executing the following command from that directory: {{%cli%}}catalyst init{{%/cli%}} 3. Navigate using the arrow keys and select your preferred portal and press the Enter key. If you have no other organizations associated with the account, then the default one will be selected automatically. <br /> You can find out more about Catalyst's multi-org portal feature from this {{%link href="/en/getting-started/catalyst-organizations/#access-the-multi-org-portal" %}}help document{{%/link%}}. 4. The CLI will now ask you to associate a Catalyst project with the directory. Associate it with the project that we created earlier from the console. Select *InvoiceNotifier* from the list and press Enter. <br /> 5. Select **Functions** using the space-bar, then press the **Enter** key to initialize. <br /> 6. The CLI will initiate the function setup. Select **Event** as the function type. <br /> 7. Select the latest runtime of **Java** as the stack and press **Enter**. <br /> 8. Enter **Cliq_Notifier** as the folder name and press **Enter**. Provide the main class name as **CliqNotifier** and press **Enter**. <br /> The Catalyst initialization is now complete. The project directory is now set up with the functions directory along with configuration files and dependencies. The project directory also contains the {{%link href="/en/cli/v1/project-directory-structure/catalyst-json/" %}}{{%badge%}}catalyst.json{{%/badge%}}{{%/link%}} configuration file and a hidden {{%badge%}}.catalystrc{{%/badge%}} file. The structure of your project directory should now appear as shown below: -------------------------------------------------------------------------------- title: "Register the Client" description: "Create an Event Driven Architecture to automate invoice updates from Zoho Books to Zoho Cliq using Event Functions and Catalyst Signals." last_updated: "2026-03-18T07:41:08.683Z" source: "https://docs.catalyst.zoho.com/en/tutorials/invoice-notifier/java/register-client/" service: "All Services" related: - Catalyst API Documentation (/en/api/introduction/overview-and-prerequisites/#OverviewandPrerequisites) -------------------------------------------------------------------------------- # Register the Client Application in Zoho API Console To enable secure and authorized communication between Catalyst and Zoho Cliq, you must register your client application in the Zoho API Console. This step is necessary to generate OAuth credentials that will be embedded in the Event Function code. By registering the client, you will receive the following: * {{%bold%}}Client ID{{%/bold%}}: A unique identifier assigned to your registered application. * {{%bold%}}Client Secret{{%/bold%}}: A confidential key used along with the Client ID to authenticate the client. We will use these credentials to generate the following OAuth tokens: * {{%bold%}}Grant Token (code){{%/bold%}}: A temporary token generated using the Client ID and Client Secret in the API console. This is used to fetch the Refresh Token. * {{%bold%}}Refresh Token{{%/bold%}}: A persistent token used to request new Access Tokens when the previous ones expire. We will generate this in the REST API client in the next step. * {{%bold%}}Access Token{{%/bold%}}: A temporary token that authorizes Zoho Cliq API calls. You do not need to manually generate this, as it will be automatically handled using the Refresh Token during runtime. The Client ID, Client Secret, and Refresh Token are added to the Event Function code. They enable Catalyst to programmatically perform actions (like posting messages) in your Zoho Cliq channel. The function will use the Refresh Token to continuously retrieve fresh Access Tokens, ensuring uninterrupted connectivity between Catalyst and Cliq. To register the client application in Zoho API console: 1. Go to the {{%link href="https://api-console.zoho.com/" %}}Zoho API Console{{%/link%}} and click {{%bold%}}Get Started{{%/bold%}} or {{%bold%}}Add Client{{%/bold%}}. <br /> 2. Choose {{%bold%}}Self Client{{%/bold%}} as the client type. Since both the Catalyst and the Cliq accounts are configured in the same organization, a Self Client can be used for this application. <br /> 3. In the popup, click {{%bold%}}Create{{%/bold%}} to register your client. The API console will generate and display the Client ID and Client Secret values for the registered client. <br /> 4. Now, click the {{%bold%}}Generate Code{{%/bold%}} tab to generate the Grant Token. - In the **Scope** field, enter: {{%badge%}}{{%bold%}}ZohoCliq.Webhooks.CREATE{{%/bold%}}{{%/badge%}} - Add a **Description** for the scope. - Set a **Time Duration** for the Grant Token. <br /> 5. Click {{%bold%}}Create{{%/bold%}}. Once created, the Grant Token (code) will be displayed. <br /> Copy the generated Client ID, Client Secret, and Grant Token, and keep them ready. We will use these values in the upcoming step to generate the Refresh Token and configure the function files in the project. -------------------------------------------------------------------------------- title: "Generate the refresh token" description: "Create an Event Driven Architecture to automate invoice updates from Zoho Books to Zoho Cliq using Event Functions and Catalyst Signals." last_updated: "2026-03-18T07:41:08.683Z" source: "https://docs.catalyst.zoho.com/en/tutorials/invoice-notifier/java/refresh-token/" service: "All Services" related: - Catalyst API Documentation (/en/api/introduction/overview-and-prerequisites/#OverviewandPrerequisites) -------------------------------------------------------------------------------- # Generate Refresh Token Before configuring the function and client components, you need to generate a **Refresh Token**, which will be included in the function code to authorize interactions with Zoho Cliq. You can use any REST API client to perform this step. In this tutorial, we’ll walk you through the process using the {{%link href="https://www.postman.com/" %}}Postman API{{%/link%}} platform. 1. Open your API client and create a new POST request to the following URL: * {{%bold%}}Request URL:{{%/bold%}} {{%badge%}}{{%bold%}}https://<span></span>accounts.zoho.com/oauth/v2/token{{%/bold%}}{{%/badge%}} * {{%bold%}}Request Method:{{%/bold%}} POST 2. Add the following keys and values as query parameters in your request: * {{%bold%}}{{%badge%}}code{{%/badge%}}:{{%/bold%}} The Grant Token or the value of code obtained during the {{%link href="/en/tutorials/invoice-notifier/nodejs/register-client" %}}client registration{{%/link%}} in the API console * {{%bold%}}{{%bold%}}{{%badge%}}client\_id{{%/badge%}}:{{%/bold%}}{{%/bold%}} The Client ID that was generated during the client registration * {{%bold%}}{{%badge%}}client\_secret{{%/badge%}}:{{%/bold%}} The Client Secret that was generated during the client registration * {{%bold%}}{{%badge%}}grant\_type{{%/badge%}}:{{%/bold%}} {{%badge%}}authorization\_code{{%/badge%}} (Provide this literal string as the value) 3. Send the request with the above parameters to the specified request URL. If the request is successful, you will receive a response that includes: {{%badge%}}access\_token{{%/badge%}}, {{%badge%}}refresh\_token{{%/badge%}}, {{%badge%}}api\_domain{{%/badge%}}, {{%badge%}}token\_type{{%/badge%}}, {{%badge%}}expires\_in{{%/badge%}}. We only require the Refresh Token. A screenshot of this step using Postman is provided below to guide you through the request and response. 4. Copy the {{%badge%}}{{%bold%}}refresh\_token{{%/bold%}}{{%/badge%}} value from the response received. You’ll use this in the function code in the next step of the tutorial. -------------------------------------------------------------------------------- title: "Configure the Event function" description: "Create an Event Driven Architecture to automate invoice updates from Zoho Books to Zoho Cliq using Event Functions and Catalyst Signals." last_updated: "2026-03-18T07:41:08.684Z" source: "https://docs.catalyst.zoho.com/en/tutorials/invoice-notifier/java/configure-function/" service: "All Services" related: - Event Functions (/en/serverless/help/functions/event-functions/) - Functions Directory Structure (/en/cli/v1/project-directory-structure/functions-directory) -------------------------------------------------------------------------------- # Configure the Event Function Let us now configure the event function {{%badge%}}Cliq_Notifier{{%/badge%}}, which automatically sends a message to a Zoho Cliq channel. This message will include the invoice details of new customers who have successfully completed their payment. The function will be executed when it is triggered by Catalyst Signals. The {{%link href="/en/cli/v1/project-directory-structure/functions-directory" %}}functions directory{{%/link%}}, {{%badge%}}functions/Cliq_Notifier{{%/badge%}} contains: - The {{%badge%}}CliqNotifier.java{{%/badge%}} main function file - The {{%badge%}}catalyst-config.json{{%/badge%}} configuration file - Java library files in the {{%badge%}}lib{{%/badge%}} folder - {{%badge%}}.classpath{{%/badge%}} and {{%badge%}}.project{{%/badge%}} dependency files You will be adding code in {{%badge%}}CliqNotifier.java{{%/badge%}} file. {{%note%}}{{%bold%}}Note:{{%/bold%}} Please go through the code in this section to make sure you fully understand it.{{%/note%}} You can directly copy the code below and paste it in {{%badge%}}CliqNotifier.java{{%/badge%}} located in the {{%badge%}}functions/Cliq_Notifier{{%/badge%}} directory and save the file. {{% panel_with_adjustment header="CliqNotifier.java" footer="button" class="language-java line-numbers" scroll="set-scroll" %}}import java.util.logging.Level; import java.util.logging.Logger; import java.util.Arrays; import java.io.IOException; import org.json.JSONObject; import org.json.JSONArray; import org.json.JSONException; import com.catalyst.Context; import com.catalyst.event.EVENT_STATUS; import com.catalyst.event.EventRequest; import com.catalyst.event.CatalystEventHandler; import com.zc.auth.connectors.ZCConnection; import okhttp3.OkHttpClient; import okhttp3.MediaType; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; public class CliqNotifier implements CatalystEventHandler { private static final Logger LOGGER = Logger.getLogger(CliqNotifier.class.getName()); private static final String ZBOOKSDOMAIN = "{{YOUR_ZBOOKS_DOMAIN}}"; //Enter your ZohoBooks Domain based on your region private static final String ZBOOKSORG = "{{YOUR_ZBOOKS_ORGANIZATION_ID}}"; //Enter your ZohoBooks Organization Id private static final String ZCLIQDOMAIN = "{{YOUR_ZCLIQ_DOMAIN}}"; //Enter your ZohoCliq Domain based on your region private static final String ZCLIQ_CHANNEL_UNIQUE_NAME = "{{YOUR_CHANNEL_UNIQUE_NAME}}"; //Enter the unique name of the channel where updates should be posted private static final String ZCLIQ_BOT_UNIQUE_NAME = "{{YOUR_BOT_UNIQUE_NAME}}"; //Enter the unique name of the bot that will post the messages private static final String ZACCOUNTSDOMAIN = "{{YOUR_ZACCOUNTS_DOMAIN}}"; //Enter your ZohoAccounts Domain based on your region @Override public EVENT_STATUS handleEvent(EventRequest event, Context context) throws Exception { try { JSONArray data = extractInvoiceData(event); JSONArray rows = transformInvoiceData(data); JSONObject requestBody = prepareCliqRequest(rows); String accessToken = getAccessToken(); sendToCliq(requestBody, accessToken); LOGGER.log(Level.INFO, "Message pushed to channel successfully"); return EVENT_STATUS.SUCCESS; } catch (Exception e) { LOGGER.log(Level.SEVERE, "An unexpected error occurred: ", e); return EVENT_STATUS.FAILURE; } } private JSONArray extractInvoiceData(EventRequest event) throws JSONException { JSONObject payload = (JSONObject) event.getRawData(); JSONArray data = payload.getJSONArray("data"); JSONArray rows = new JSONArray(); for (int i = 0; i < data.length(); i++) { JSONArray invoices = data.getJSONArray(i); for (int j = 0; j < invoices.length(); j++) { rows.put(invoices.getJSONObject(j)); } } return rows; } private JSONArray transformInvoiceData(JSONArray rows) throws JSONException { for (int i = 0; i < rows.length(); i++) { JSONObject row = rows.getJSONObject(i); String invoiceId = row.optString("Invoice Id"); row.put("Link", "https://" + ZBOOKSDOMAIN + "/app/" + ZBOOKSORG + "#/invoices/" + invoiceId); row.remove("Invoice Id"); } return rows; } private JSONObject prepareCliqRequest(JSONArray rows) throws JSONException { JSONArray headers = new JSONArray(Arrays.asList( "Customer", "Invoice Number", "Amount", "Paid On", "Link" )); JSONObject tableData = new JSONObject() .put("headers", headers) .put("rows", rows); JSONObject slide = new JSONObject() .put("type", "table") .put("data", tableData); return new JSONObject() .put("text", "Here are the invoices marked as Paid in the last hour:") .put("slides", new JSONArray().put(slide)); } @SuppressWarnings("unchecked") private String getAccessToken() throws Exception { org.json.simple.JSONObject authConfig = new org.json.simple.JSONObject(); org.json.simple.JSONObject connectorConfig = new org.json.simple.JSONObject(); authConfig.put("client_id", "{{YOUR_CLIENT_ID}}"); //Enter your Client ID authConfig.put("client_secret", "{{YOUR_CLIENT_SECRET}}"); //Enter your Client Secret authConfig.put("auth_url", "https://" + ZACCOUNTSDOMAIN + "/oauth/v2/auth"); authConfig.put("refresh_url", "https://" + ZACCOUNTSDOMAIN + "/oauth/v2/token"); authConfig.put("refresh_token", "{{YOUR_REFRESH_TOKEN}}"); //Enter your Refresh Token connectorConfig.put("CliqConnector", authConfig); return ZCConnection.getInstance(connectorConfig).getConnector("CliqConnector").getAccessToken(); } private void sendToCliq(JSONObject payload, String accessToken) throws IOException { String cliqUrl = "https://" + ZCLIQDOMAIN + "/api/v2/channelsbyname/" + ZCLIQ_CHANNEL_UNIQUE_NAME + "/message?bot_unique_name=" + ZCLIQ_BOT_UNIQUE_NAME; Request request = new Request.Builder() .url(cliqUrl) .addHeader("Authorization", "Zoho-oauthtoken " + accessToken) .addHeader("Content-Type", "application/json") .post(RequestBody.create(MediaType.parse("application/json"), payload.toString())) .build(); try (Response response = new OkHttpClient().newCall(request).execute()) { if (!response.isSuccessful()) { throw new IOException("Unexpected response from Cliq API: " + response.body().string()); } } } } {{% /panel_with_adjustment %}} {{%note%}}{{%bold%}}Note:{{%/bold%}} After you copy and paste the code into your function file, make sure to update the following placeholders with actual values, as indicated by the inline comments: - **Zoho Books Domain (line 27)**: Enter the domain corresponding to your {{%link href="https://www.zoho.com/in/books/" %}}**Zoho Books**{{%/link%}} organization, based on your region. Example: books.zoho.com, books.zoho.eu, or books.zoho.in - **Zoho Books Organization ID (line 28)**: Provide the unique Organization ID of your Zoho Books account. - **Zoho Cliq Domain (line 30)**: Specify the domain of your {{%link href="https://www.zoho.com/cliq/" %}}Zoho Cliq{{%/link%}} organization, based on your region. Example: cliq.zoho.com, cliq.zoho.eu - **Unique Name of your Zoho Cliq Channel (line 31)**: Enter the unique name of the {{%link href="https://help.zoho.com/portal/en/kb/zoho-cliq/user-guides/channels" %}}Zoho Cliq channel{{%/link%}} where the paid invoice updates should be posted. - **Unique Name of your Zoho Cliq Bot (line 32)**: Provide the unique name of the {{%link href="https://www.zoho.com/cliq/help/platform/bots.html" %}}Zoho Cliq bot{{%/link%}} that has been added to the above channel. - **Zoho Accounts Domain (line 34)**: Mention the {{%link href="https://www.accounts.zoho.com/" %}}Zoho Accounts{{%/link%}} domain used to log into Catalyst, Zoho Books, and Zoho Cliq. Example: accounts.zoho.com, accounts.zoho.in - **Client ID (line 109)**: Paste the Client ID obtained during client registration in {{%link href="/en/tutorials/invoice-notifier/nodejs/register-client/" %}}Step 4{{%/link%}}. - **Cient Secret (line 110)**: Paste the corresponding Client Secret generated in {{%link href="/en/tutorials/invoice-notifier/java/register-client/" %}}Step 4{{%/link%}}. - **Refresh Token (line 113)**: Provide the Refresh Token you generated in {{%link href="/en/tutorials/invoice-notifier/java/refresh-token/" %}}Step 5{{%/link%}} using your API client tool. {{%/note%}} The Event function is now configured. -------------------------------------------------------------------------------- title: "Deploy the Project" description: "Create an Event Driven Architecture to automate invoice updates from Zoho Books to Zoho Cliq using Event Functions and Catalyst Signals." last_updated: "2026-03-18T07:41:08.684Z" source: "https://docs.catalyst.zoho.com/en/tutorials/invoice-notifier/java/deploy-project/" service: "All Services" related: - Deploy CLI Resources (/en/cli/v1/deploy-resources/introduction/) - Web Client Hosting (/en/cloud-scale/help/web-client-hosting/introduction) -------------------------------------------------------------------------------- # Deploy the Project To {{%link href="/en/cli/v1/deploy-resources/introduction/" %}}deploy your Catalyst project{{%/link%}} from the CLI, run the following command in your terminal from your project directory: {{%cli%}}catalyst deploy{{%/cli%}} The event function is now deployed to the console. -------------------------------------------------------------------------------- title: "Create a Rule" description: "Create an Event Driven Architecture to automate invoice updates from Zoho Books to Zoho Cliq using Event Functions and Catalyst Signals." last_updated: "2026-03-18T07:41:08.684Z" source: "https://docs.catalyst.zoho.com/en/tutorials/invoice-notifier/java/create-rule/" service: "All Services" related: - Publishers (/en/signals/help/publishers/key-aspects/) - Targets (/en/signals/help/targets/key-aspects/) - Rules (/en/signals/help/rules/key-aspects/) - Events (/en/signals/help/events/key-aspects/) - Event Functions (/en/serverless/help/functions/event-functions/) -------------------------------------------------------------------------------- # Create a Rule Now that the Publisher and the Event Function are configured, let us define how the events should be processed and delivered by setting up a Rule. Follow these steps to create the Rule: 1. In the Developer Console, select your project: *InvoiceNotifier*. 2. Go to **Catalyst Signals** and click on **Rules** in the left navigation. <br /> 3. Click **Add Rule**, then provide a name and description for your rule. <br /> ### Define Event Source 4. Under Source, click **Choose Event**, and select the Zoho Books Publisher you added earlier. 5. From the list of available events, choose *Customer Payment Created*, then click **Done**. <br /> ### Define Event Filter 6. In the Filter section, click the **edit icon** and choose **Events matching certain conditions**. <br /> 7. Create a filter condition to include only events where the invoice status is **Paid**: - In the Path dropdown, select the JSON path that corresponds to the **payment_status** field. - Define the condition to match Paid. 8. Click **Save** to apply the filter. <br /> ### Configure Target Settings 9. Click **Choose Target** and give your target a name. 10. Under **Consumer Type**, select the Event Function we created earlier using the CLI. 11. Set the **Dispatch Policy** to **Batch by Interval**: - Choose an interval of *one hour*. - Set the Retry Count to *five*. <br /> ### Transform the Payload 12. In the **Target Input** section, choose **Transform**. 13. From the default event payload of the *Customer Payment Created* event, select only the required data and structure them as shown below. {{% panel_with_adjustment header="Expected Event Payload" footer="button" class="language-json line-numbers" scroll="set-scroll" %}}{ "data" : [ [ { "Customer" : "test", "Invoice Number" : "Customer opening balance", "Amount" : "₹3,24,244.00", "Paid On" : "31/10/2023", "Invoice Id" : "275557000000158181" } ] ] } {{% /panel_with_adjustment %}} {{% panel_with_adjustment header="Data Mapping for Template Compiler" footer="button" class="language-text line-numbers" scroll="set-scroll" %}}{ "data" : $.events.forEach((event)-> event.data.payment.invoices.forEach((invoice)-> { "Customer" : event.data.payment.customer_name, "Invoice Number" : invoice.invoice_number, "Amount" : invoice.total_formatted, "Paid On" : event.data.payment.date_formatted, "Invoice Id" : invoice.invoice_id } ) ) } {{% /panel_with_adjustment %}} Paste this structure into the template compiler to extract the required fields and click **Generate Output**. Check out the {{%link href="/en/signals/help/targets/event-body-setup/event-transformation/"%}}Even Body Transformation help guide{{%/link%}} to learn how to customize event payloads in detail. 14. Save the target configurations, then click **Save** again to finalize the rule. Now, whenever a customer completes a payment, the corresponding invoice in Zoho Books is updated. This update triggers an event that is processed every hour in Catalyst Signals and automatically sends a summarized message to the Zoho Cliq channel.