In this tutorial, you will learn how to set up Integromat and PDF.co to receive and automatically extract the PDF attachments from incoming emails and split these PDF attachments into individual PDF pages. Then you will learn how to add uploading of generated PDF files into online storage like Dropbox or Google Drive.
You will need the following modules to set up and connect:
- Webhooks (in Mailhook mode that will intercept incoming emails)
- Flow Control (in Iterator so it will take multiple attachments and we can process each attachment separately)
- PDF.co PDF Split module (to process every attachment received)
Screenshot of All Connected Modules Once Completed
1. First, let’s set up the Webhooks module with a Custom Mailhook trigger. Click on the Add button to Add a hook and copy the generated address to set as your email forwarding address.
2. Next, let’s add the Flow Control module and its Iterator function. It will go through the array of attachments and will call the next module for every attachment. Please select Attachments in the Array field.
3. Then, let’s add our 3rd module the PDF.co. Kindly select the Split a PDF function so we can split the PDF attachments.
- In the Input File field, select Upload a File. It means we are putting an input file into PDF.co instead of input Url.
- In the Source file field, choose Flow Control – Iterator. The Flow Control – Iterator is holding a single PDF attachment extracted from email.
- In the Pages field, enter the page numbers, for example, 1,1,1,1. It means to take the very first page and will create four different pdf files. We can set page ranges here as well, for example 1-2`.
- In the 2nd Source file field, select Flow Control – Iterator. This instructs PDF.co to take a single attachment from the Iterator module.
4. We are now ready to test our configuration. Kindly click on the Run button to see the result.
5. Great! We have successfully set up our modules. In the Webhooks output, you’ll see the details of the received email.
Screenshot of the Webhooks Output
6. In the Iterator output, you’ll find the filename of the PDF attachment that came with the email.
Screenshot of the Flow Control – Iterator Output
7. And in the PDF.co output, you’ll see the DataAsArray array generated for the PDF attachment’s split pages. This array contains pdf files generated by PDF.co PDF Splitter:
Screenshot of the PDF.co Output
8. Now if you want to automatically upload these generated PDF files to online storage like Dropbox or Google Drive, just add another
Flow Control – Array Iterator” that will go through DataAsArray array and will call the next module one by one for each item in the array.
Now add new Flow Control – Array Iterator and set DataAsArray from PDF.co as input:
9. Finally, connect Flow Control – Array Iterator to Dropbox (or another online storage)
Here is the final scene you should have:
The final scenario can handle emails with multiple attachments and then can process every single attachment, split attachment into multiple PDF files and upload every single PDF file into online storage. Here is how it works, step by step:
- “WebHooks – Custom Mailhooks” module accepts emails with attachments;
- It generates Attachments array that contains one or more attachments from incoming email;
- “Flow Control – Array Iterator” goes through this Attachments array and calls PDF.co module for every single attachment in it;
- “PDF.co – Split a PDF” module splits input pdf attachment into multiple PDF files and returns DataAsArray array that contains generated pdf documents;
- Another “Flow Control – Array Iterator” module goes through DataAsArray array and calls Dropbox module for every single PDF file from DataAsArray
- Dropbox module uploads every single PDF file generated by “PDF.co – Split a PDF” module;
In this tutorial, we learned how to set up Webhooks to receive incoming emails. We configured the Iterator to get the PDF attachments from the previous step. And most of all, we learned how to use the Split function in PDF.co to split PDF pages into individual PDF documents and then how to automatically upload pdf files generated by PDF.co to online storage like Dropbox or Google Drive.