Close this search box.

How to scrape inbound emails for file attachments and automatically attach files to Zoho CRM records

November 22, 2020
Subscribe to Blog Updates

How to scrape inbound emails for file attachments and automatically attach files to Zoho CRM records

As popular as shared cloud storage has become, there is nothing quite as fast and easy as emailing files when trying to transfer files to another person. We recently had a client who was drowning in email file attachments. While there are many alternatives, some folk just love email and attachments, #FullStop! It is super easy for clients!  Our client wanted a solution that would:

  • Examine / Scrape all inbound emails for attachments
  • Disregard email attachments of pictures, signature files, etc. We only needed doc, docx, pdf and xls file types
  • If the email was from a lead or contact already in our Zoho CRM, go ahead and parse out the email file attachments and add the files individually to the matched Zoho CRM contact or lead in the CRM attachment related list (See screen shot below). And for those wondering, yes, we can also create a new contact / lead if one does not exist in our database.

As we thought about the requirement, Zoho Flow immediately came to mind. The thought was short-lived as we remember how past clients using Zoho Flow had failed when wanting to build solutions that transfer files via webhooks and/or third-party connections. Zoho Flow still has attachment transferring limitations at the time of writing this.

Our solution was to use Zapier to push email attachments to Zoho CRM records

We created a Zapier account and began exploring the integration. We started with the Zapier email parser configuration. We created a Zapier email parser email address and a rule to forward all emails with an attachment to the unique Zapier email parser email address. It did well at first, then we tested with multiple file attachments. The parser was automatically putting all the attachments into a single zip file in the Zoho CRM attachment-related list. That’s not what we wanted :). We discovered the “New Attachment in Gmail” task. After digging in a little further, this new Gmail attachment task does post email files individually to the Zoho CRM-related attachments list. Yes, our client was using GSuite to host their email so we lucked out here and stopped our rabbit hole exploration…

We added a Zapier filter that allowed us to exclude files that were not word processor files such as pdf, doc, and docx. The last thing you want is contact records with emoji files and email signature files all-up-in your CRM

Next up, we had to configure Zapier to lookup existing leads/contacts in our Zoho CRM database with the same email address. The “Find module entry in Zoho CRM” task will find the ID of the matching record. This means when john doe emails us, we note his From: email address and we query Zoho CRM for John’s email address to find his contact ID. We will use his contact ID in the next step.

Next up, now that we know John Doe’s Contact ID, we are ready to post the file(s) to his Zoho CRM Record. We use the “Add Attachment in Zoho CRM” task. Now, when you are mapping the “File Name” and “Attachment File” fields (as shown in the screenshot below), use the mapping we just mentioned. There are many Gmail email meta fields options here so be sure to test before you stick a fork in it and call it done!

Our final Zap is shown below. Isn’t it beautiful! 🙂

There you have it! That is the solution we used to scrape inbound emails and post the attachments to the corresponding Zoho CRM record. After deploying this solution, we started brainstorming what other things we could do, how we would do things differently. If you’re curious, please do reach out to the team at QuakeCinch for your Zoho CRM needs!