--- title: "Create a Rule" url: https://docs.catalyst.zoho.com/en/tutorials/invoice-notifier/python/create-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-08-17T12:16:04Z service: All Services type: tutorial related_links: - name: "Publishers" url: /en/signals/help/publishers/key-aspects/ - name: "Targets" url: /en/signals/help/targets/key-aspects/ - name: "Rules" url: /en/signals/help/rules/key-aspects/ - name: "Events" url: /en/signals/help/events/key-aspects/ - name: "Event Functions" url: /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. ![Add Rule](https://catalyst-docs-development.zohostratus.in/images/tutorials/invoice-notifier/rule.webp) 3. Click **Add Rule**, then provide a name and description for your rule. ![Provide name and description for the Rule](https://catalyst-docs-development.zohostratus.in/images/tutorials/invoice-notifier/create-rule.webp) ### 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**. ![Configure the publisher and event for the rule](https://catalyst-docs-development.zohostratus.in/images/tutorials/invoice-notifier/source.webp) ### Define Event Filter 6. In the Filter section, click the **edit icon** and choose **Events matching certain conditions**. ![Select Events matching certain conditions](https://catalyst-docs-development.zohostratus.in/images/tutorials/invoice-notifier/filter.webp) 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. ![Configure filter for the rule](https://catalyst-docs-development.zohostratus.in/images/tutorials/invoice-notifier/filter-criteria.webp) ### 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*. ![Configure target settings](https://catalyst-docs-development.zohostratus.in/images/tutorials/invoice-notifier/target-settings.webp) ### 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. **Expected Event Payload** ```json { "data" : [ [ { "Customer" : "test", "Invoice Number" : "Customer opening balance", "Amount" : "₹3,24,244.00", "Paid On" : "31/10/2023", "Invoice Id" : "275557000000158181" } ] ] } ``` **Data Mapping for Template Compiler** ```text { "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 } ) ) } ``` Paste this structure into the template compiler to extract the required fields and click **Generate Output**. ![Event Body Transformation](https://catalyst-docs-development.zohostratus.in/images/tutorials/invoice-notifier/transformation.webp) Check out the [Even Body Transformation help guide](https://docs.catalyst.zoho.com/en/signals/help/targets/event-body-setup/event-transformation/) 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. ![Invoice Notifier](https://catalyst-docs-development.zohostratus.in/images/tutorials/invoice-notifier/demo.webp)