Generate Document action in Zapier
Generating documents using Mail merge is the method of reading data from a data source and replacing corresponding variables in a template document. It usually requires two files, templates for storing the merge fields - the variable for the data to be inserted. The other contains both the instructions for formatting the variable data and the information that will be identical across each result of the mail merge.
With a PDF4me integration for Zapier, you can make use of the Generate Document action - which is one of the many actions that PDF4me provides to manage documents - to create Zaps that can generate documents from Word templates. You can make use of the API or Automation calls to fuel these Zaps to mass-generate HTML documents.
How to design Word Templates?
Templates can be created using various syntaxes. PDF4me accepts Word, HTML, and PDF templates for generating documents.
You can manually create the merge fields or tokens in the following syntax
Quick links for designing your Word Template
How to create a Generate Document Zap?
Now let us look at a sample example template with a table and conditions to generate PDF invoices.
Add a trigger to start the Zap
Zapier has several available triggers for starting a Zap. You can choose the preferred trigger based on where you store your source files. In the example, we are using the Dropbox trigger. Add a New file in Dropbox trigger for Dropbox to trigger the Zap.
Add Download from Dropbox actions for Template & Data
To pass the Template and Data to the Generate Document action, we need to download the Template and associated data from the source. Since we are using Dropbox here, we use the Download from Dropbox action.
Add the Generate Document Action from PDF4me
Once the files are downloaded, we must pass them to the Generate Document action. In the action, configure the Template file name and Data file name. Also, select the Data type. PDF4me allows 2 types of Data in the Mustache rendering type - XML and JSON. We are using JSON in the current example.
Configure the parameters accordingly in the PDF4me Generate Document action. Map the Template file and Data file and provide the names of the data file and template file with proper extensions.
Add Upload to Dropbox action
PDF4me provides 2 actions with the same capability. The only difference being one generates a single document and the other produces multiple documents from the template based on the data.
When multiple documents are generated, for each file, the Zap should save the file to the desired location. We use the For Each control action to handle when multiple output files are expected.
Add the following Dropbox action inside the loop.
You can accordingly configure the following fields in the Loop action and make sure the Upload to Dropbox action is inside the looper.
The output of our example would look like below -
With a PDF4me Developer Subscription, you can create workflows that can automate the mass generation of documents with dynamic data with the least manpower and low cost. The subscription ensures your automation never stops due to any shortage of the number of API calls.