🎉  Build a workflow powerhouse. Learn more about our new Airtable integration.   🎉

July 26, 2016

Automatically Generate Contracts from Emails using mailparser.io

Automation can be a great way to simplify your life.  With a tool like mailparser.io, you can setup a system to automatically parse data out of your emails and send it to your favorite online services.
Combine mailparser.io with WebMerge and you can automatically generate all kinds of documents from contracts, letters, invoices, and more.  You’ll never have to copy and paste again!

In this example, we’re going to show you how to automatically take data from an email we receive via mailparser.io and generate a contract that we’ll have signed through HelloSign.

To get started, we’re going to setup the template for our contract using a Word document.  Inside our Word document we’re going to add our boilerplate contract information and then for the spots that we want to insert our customer’s information, we’re going to use merge fields that look like {$Name}, {$Address}, etc.

Here’s what our contract template looks like:

Since we’ll be collecting a signature on our contract using HelloSign, we need to add a signature tag so that HelloSign knows where to place the signature in our document.  This signature tag is just like any other text in the document and looks like:  [sig|req|signer1]

Once you have finished your contract template, we need to upload it to WebMerge.  From the Documents page in WebMerge click the New Document button and give it a name.  On the next step, pick Office Document and then select the file from your computer.

After you upload your template, you’re going to be taken to the Settings tab where you can change various settings like the type of file that is generated and the name of the file.  For this example, we’re going to generate a PDF and then include the name of our client in the contract.

Next, we’re going to setup the Delivery of our document so that it is automatically sent over to HelloSign for signature after it is generated.  From the Deliver tab, click the New Delivery button and then select HelloSign from the list.  After you enter your HelloSign API Key, you’ll need to choose the merge fields that hold the name and the email address of the signer.

Once we have the HelloSign delivery finished, we’re ready to setup the integration with mailparser.io!  To send data from mailparser.io to WebMerge, we’re going to use their Webhooks integration, so we need to grab the Merge URL for our document.

Under the Merge tab, you will find the Merge URL for your document.  This is a unique webhook endpoint that mailparser.io will use to send data to your contract template.  Go ahead and copy this URL for later.

Inside mailparser.io, you’ll need to setup your inbox for this process.  We’ll be processing emails from a lead generation form.  Once you have the Parsing Rules setup for your inbox, we need to setup the Webhook Integration to WebMerge.

From the Webhook Integrations page, choose Webhooks from the list.  Go ahead and give your webhook a name like “Send Contract” then choose JSON as the payload and enter your Merge URL in the Target URL box.

The other options, we’ll be sending an HTTP POST with a flat variable structure.

After you have finished the webhook, go ahead and save then it’s time to run a test!  Send a new email to your mailparser.io inbox and then that data will automatically be sent over to WebMerge where your contract will be generated and sent to HelloSign.

Here’s what our contract looked like ready to sign:

Congrats, you’re all done!  You can now automatically generate all kinds of documents from a simple email.  Can you think of any other ways that you can use WebMerge to simplify your paperwork process?

6 min read

Ready to give Formstack Documents a try?
Start your Free Trial now!


Create Contracts from mailparser.io Now

By signing up here, you agree to our Terms of Use