Deluge in Zoho services #1: Zoho Mail

Deluge in Zoho services #1: Zoho Mail

Hello everyone,

We hope to present the various Zoho services that support Deluge through a series of posts. In today's post let us explore Deluge in Zoho Mail.

Filters is the Zoho Mail feature that encompasses Deluge. When a Deluge function is associated with a Zoho Mail filter, the configured filter criteria acts as a rule based on which the Deluge function will be triggered.


Let's assume a vendor sends invoices of your purchases to your email from . Whenever you receive the invoice email, you post the invoice ID, invoice date, and Total amount details in a Zoho Cliq channel. However, manually posting the invoice details in a channel is not only monotonous but also could lead to accidental blunders or any manipulation of data. To overcome this, Deluge can be used to automate the whole process. All the invoices follow the below structure.

Follow the below steps to achieve the mentioned automation.


Step 1: Navigate to Deluge

1. Click settings icon on the right pane and click Create New Incoming Filter from the Filters card.

2. A Deluge function needs to be triggered whenever a mail is received from . Hence, provide the following filter conditions, choose Custom function (Creator) under Actions, and click Select Function.

3. A popup window with Deluge custom function , frequently used Deluge functions as gallery functions and Deluge's connections page will be displayed.

Step 2: Script using Deluge

1. Navigate to DRE Connectors tab and create a Zoho OAuth connection with scopes ZohoMail.messages.READ and ZohoCliq.Webhooks.CREATE . Name the connection as extractandpost .

Note: This connection is used to authenticate the Zoho Cliq account in which the message will be posted.

2. Navigate to Custom function tab, write the following script, and click Save. You can use the Test Run button to execute your script for a specific email.
  1. // Fetch message details using Zoho Mail integration task
  2. messageDetails = zoho.mail.getMessage(mail_messageId, "extractandpost");

  3. // Get the mail content
  4. mailContent = messageDetails.get("CONTENT");

  5. // Handle the returned text to structure it in a valid XML format
  6. mailContent = mailContent.replaceAll("<meta />","");
  7. mailContent = mailContent.replaceAll("&nbsp;","");

  8. // Use XPath to fetch the required details from the XML
  9. invoiceId = mailContent.executeXPath("/div/div/div/div[7]/text()");
  10. invoiceDate = mailContent.executeXPath("/div/div/div/div[8]/text()");
  11. invoiceTotal = mailContent.executeXPath("/div/div/div/div[13]/text()");

  12. // Format the fetched details to post in Zoho Cliq channel
  13. textToPost = "Zylker invoice\nInvoice ID: " + invoiceId + "\nInvoice Date: " + invoiceDate + "\nTotal: " + invoiceTotal;

  14. // Post the formatted text in the required Zoho Cliq Channel
  15. zoho.cliq.postToChannel("OrdersChannel", textToPost, "extractandpost");

3. Click Select Custom Function button to associate the function with the Filter.

Step 3: Save the filter

Now that the configuration is done, if an email is received from , the mail content will be parsed and the required details will be posted in Zoho Cliq Channel automatically.

Note: This example assumes emails from always follow the same email template. The XML handling and XPath used in the provided example script is specific to this email template.

Please check the attachments for the sample XML file based on which the provided example script works.

We hope you found this post useful. We will explore Deluge in Zoho Writer in the next post. Please let us know your questions, feedback, and suggestions in the comments or write to us at .

Stay safe!

Related Links

    Zoho Marketing Automation

          • Sticky Posts

          • Function #41: Sync Associated Subforms!

            Welcome back everyone! The last custom function showed how to update a Contact with Product details from it's Related list in Deals. This week, let's look at a function that lets you update subform records in two modules simultaneously when one of them is updated. Business scenario Let's look at how subform helps in an education institution that has deployed Zoho CRM. National Public School, Austin (made up, of course!) has set up Zoho CRM and it follows the same relationship pattern of "Students",

          Zoho Pagesense Resources

            Zoho SalesIQ Resources

                  Zoho TeamInbox Resources

                    Zoho DataPrep Resources

                      Zoho CRM Plus Resources

                        Zoho Books Resources

                          Zoho Subscriptions Resources

                            Zoho Desk Resources

                              Zoho Projects Resources

                                Zoho Sprints Resources

                                  Qntrl Resources

                                    Zoho Creator Resources

                                      Zoho WorkDrive Resources

                                          Zoho Campaigns Resources

                                            Zoho CRM Resources

                                                    Design. Discuss. Deliver.

                                                    Create visually engaging stories with Zoho Show.

                                                    Get Started Now