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.

Example

Let's assume a vendor sends invoices of your purchases to your email from vendor@zylker.com . 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 vendors@zylker.com . 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 vendors@zylker.com , the mail content will be parsed and the required details will be posted in Zoho Cliq Channel automatically.

Note: This example assumes emails from vendors@zylker.com 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 support@zohodeluge.com .

Stay safe!
 

Related Links








                            Zoho Desk Resources

                            • Desk Community Learning Series


                            • Digest


                            • Functions


                            • Meetups


                            • Kbase


                            • Resources


                            • Glossary


                            • Desk Marketplace


                            • MVP Corner


                            • Word of the Day



                                Zoho Marketing Automation


                                        Manage your brands on social media



                                                Zoho TeamInbox Resources

                                                  Zoho DataPrep Resources



                                                    Zoho CRM Plus Resources

                                                      Zoho Books Resources


                                                        Zoho Subscriptions Resources

                                                          Zoho Projects Resources


                                                            Zoho Sprints Resources


                                                              Qntrl Resources


                                                                Zoho Creator Resources


                                                                  Zoho WorkDrive Resources



                                                                    Zoho Campaigns Resources

                                                                      Zoho CRM Resources

                                                                      • CRM Community Learning Series

                                                                        CRM Community Learning Series


                                                                      • Tips

                                                                        Tips

                                                                      • Functions

                                                                        Functions

                                                                      • Meetups

                                                                        Meetups

                                                                      • Kbase

                                                                        Kbase

                                                                      • Resources

                                                                        Resources

                                                                      • Digest

                                                                        Digest

                                                                      • CRM Marketplace

                                                                        CRM Marketplace

                                                                      • MVP Corner

                                                                        MVP Corner

                                                                      





                                                                      




                                                                          Design. Discuss. Deliver.

                                                                          Create visually engaging stories with Zoho Show.

                                                                          Get Started Now