🎉  WebMerge is now Formstack Documents! Learn More   🎉

Close
May 28, 2015

Generate Custom Invoices from Podio

We recently highlighted how you can generate inspection reports from your Podio account and we’ve had a lot of people try it out!  With that in mind, we’d like to show you another example for integrating WebMerge with Podio to automatically generate documents with data saved in your apps.  For this example, we’re going to show you how to populate an invoice with the click of a button.

As always, our first step is to setup our template (document) in WebMerge.  We’re going to use the “Build Your Own” document type and build it directly in the online editor.  We’ll add the basic information about the business, our logo, contact info, then the table for our line items.

To determine the field names to use in our document, you’ll need to login to Podio and go to the Developer page for your app.  On this page, you’ll see a list of the fields that are in the app.  You’ll notice there is an “External ID” column in the table.  This is the field name that you’ll want to use (however, if there is a hypen in the ID, then change that to an underscore.  IE first-name would be first_name).  You’ll reference the fields by using this format: {$fields.EXTERNAL_ID}

Here’s what the template looks like so far
 


The table for the line items takes a little extra programming.  We’re going to use the “tablerow” tag in our document to indicate that we want to loop through the list of line items and build a new row in the table.  Inside the table loop, you’ll reference the individual fields for each line item.

The table row will look something like this:

{tablerow from=$fields.products item=_row}     {$_row.fields.title}

Here’s what the table looks like in the document.
 


Now that we’ve got our document setup, we’re ready to setup the integration with Podio.  We’re going to leverage the webhook feature that Podio has built into their app.  To generate the Webhook URL, we’ve setup an easy script here: https://www.webmerge.me/scripts/podio

After you login to Podio through the script, you’ll be asked for your Merge URL.  This is the URL that you’ll find under the Merge tab for your document inside WebMerge.  You’ll also see an option to add a filter to the webhook.  This filter will tell our system to ignore any webhooks where the condition doesn’t match.  For example, you could add a Category “status” field in your Invoice app that gives options like “Draft” and “Send Invoice”.  Then you can add the filter for “status” and when it matches “Send Invoice”.

Here’s what the webhook setup looks like:
 


The next step is to take the generated webhook and copy & paste that into Podio.  You will do this under the Developer page for your Invoice app (where you found the field names earlier).  You’ll want to choose “item.update” as the webhook type.  This tells podio to send the webhook each time an item is updated in the app.
 


Great work!  Now that you’ve got the webhook setup, you should start receiving the invoices when you click the “Send Invoice” button on your invoices!  Go ahead and give it a try :)

Here’s what our invoice looks like:
 


If you’re missing any fields, we suggest you turn on debug mode inside WebMerge so you can explore the data that is coming from Podio.  To turn this on, go to the Settings tab for your document in WebMerge and turn on Test Mode.  You should then see a checkbox to save data – check that and save.  Now that you’ve got that turned on, go trigger another merge in Podio (select the “Send Invoice” option).

Once you trigger a new merge, go to the Overview tab for your document and you should see a “View Data” button next to your most recent merge.  Click that button and you’ll see a popup with all of the data from Podio.  You can click the field names to see the exact merge field codes to use in your document!
 


Can you think of other ways that you can use WebMerge to automate your document generation from Podio?
 
 

6 min read

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

×

Create Invoices From Podio Now

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