🎉 Celebrate with 10% OFF on All Products! Use Code: GFEX10 Or Buy Any 2+ Items for 30% OFF with Code: GFEX30!

Gravity Forms Formstack Documents Integration Premium Add-on Setup Guide

Updated 9 min read Gravity Forms Integrations A–Z
On this page
  1. Video walkthrough
  2. What the Add-on Does
  3. Installation
  4. Step 1: Connect Your Formstack Documents Account
  5. Step 2: Create a Feed and Choose the Document
  6. Step 3: Map the Merge Fields
  7. Step 4: Test the Document
  8. Step 5: The Finished Document
  9. The Entry Screen
  10. Links in Confirmations and Notifications
  11. Paid Forms
  12. Errors
  13. For Developers
  14. Troubleshooting
  15. The document list is empty.
  16. A merge field stays empty in the document.
  17. The confirmation shows no link.
  18. What happens to the files when I delete an entry?
  19. What happens without an active licence?
  20. Create Documents From Gravity Forms

Video walkthrough

Gravity Forms Formstack Documents Integration: Feeds, Merge Fields and Errors (WordPress Side)
Watch: connect Gravity Forms to Formstack Documents, shown on the WordPress side. Watch on YouTube

The Merge fields section of a Formstack Documents feed in Gravity Forms: the list of fields found in the Lease agreement template and the field mapping table with the merge fields FirstName, LastName, Email, Unit, MonthlyRent, MoveInDate and Occupants matched with the form fields Name (First), Name (Last), Email, Unit, Monthly rent, Move-in date and Occupants, a LeaseNumber merge field filled with the custom value NR-{entry_id}-{Unit:4}, and the option to also send every form field
Form Settings → Formstack Documents: the merge fields of the template, matched with your form fields.

Requirements

  • WordPress 6.5 or newer and PHP 7.4 or newer.
  • Gravity Forms 2.9 or newer (any licence). Tested with Gravity Forms 2.9 and 3.1.
  • A Formstack Documents account (formerly WebMerge) with API access: you need its API key and API secret.
  • No partner programme and no service in between: the add-on talks to the Formstack Documents API with your own key.

What the Add-on Does

Formstack Documents fills templates (Word, PDF, Excel, PowerPoint or HTML) with data and turns them into finished files such as contracts, lease agreements, applications, invoices, quotes and certificates. The add-on sends each Gravity Forms entry to the template you choose and takes care of the file that comes back: it keeps the file on the entry, adds a note, puts a link in your confirmation and notifications, attaches the file to e-mails and lets you create the document again at any time.

You can use a single document or a data route. A data route is set up in Formstack Documents and picks one or more documents by its own rules, for example a lease agreement for everybody and a pet addendum only when the applicant has pets. Deliveries that you set up in Formstack Documents, such as e-mail, cloud storage or e-signature, keep working as before.

Installation

  1. Download the add-on zip from your GravityExtra account and upload it in Plugins → Add New → Upload Plugin, then activate it.
  2. Go to Forms → Settings → Formstack Documents, enter your key in the Gravity Extra License section and click Activate License.
  3. In the same screen, connect your Formstack Documents account (next step).

Step 1: Connect Your Formstack Documents Account

  1. In Formstack Documents, open Settings → API Access and copy the API key and the API secret. Create a new key pair if you do not have one yet.
  2. Paste both values in Forms → Settings → Formstack Documents.
  3. Click Test the connection. The add-on lists your account and shows how many documents and data routes it found, for example “Connected: 3 documents and 1 data route found.”
  4. Click Save Settings. A wrong key or secret is refused on save with the answer of the API, so a typo is caught at once.

The API secret is a password field and is never written to entry notes, logs or e-mails. A feed can also use another account of its own, for example when a second office or a client has its own Formstack Documents account.

Step 2: Create a Feed and Choose the Document

Open your form, go to Settings → Formstack Documents and click Add New. Give the feed a name and pick the template in Document or data route. The list is grouped into documents (with their output type, such as PDF or XLSX) and data routes. When you choose one, the feed is saved and the merge fields of that template are loaded. Changed a template or added a new one in Formstack Documents? Click Refresh the list.

Step 3: Map the Merge Fields

Merge fields are the tags in your template, such as {$FirstName} or {$MonthlyRent}. The feed shows the fields it found in the template, and the first time you save with a document, every merge field gets its own row, already matched with the form field of the same name. Spaces, capitals and punctuation do not matter: MonthlyRent matches a field called “Monthly rent” and FirstName matches the first name of a Name field.

For every row you can choose:

  • A form field or one of its parts, such as the first name, the street of an address or a single checkbox.
  • Entry details such as the entry ID, the date or the source page.
  • A custom value: text mixed with Gravity Forms merge tags, for example NR-{entry_id}-{Unit:4} for a lease number.
  • Another merge field: type a name that is not in the list, for example a field that only a delivery or a data route rule uses.

Values are sent the way Formstack Documents expects them. A List field with columns is sent as rows, so your template can loop over it (one line per occupant, item or participant). A file upload field with several files is sent as a list of links. Tick Also send every form field to send all fields by their admin label or label as well, together with entry_id, form_title and date_created. The data of a typical entry looks like this:

{
  "FirstName": "Ana",
  "LastName": "Ruiz",
  "Email": "ana.ruiz@mail.example",
  "Unit": "3C",
  "MonthlyRent": "1450",
  "MoveInDate": "11/01/2026",
  "LeaseNumber": "NR-1042-3C",
  "Occupants": [
    { "Name": "Ana Ruiz", "Age": "34" },
    { "Name": "Jamie Ruiz", "Age": "9" }
  ]
}

And a template can use it like this:

Tenant: {$FirstName} {$LastName}
Unit {$Unit}, monthly rent {$MonthlyRent}, from {$MoveInDate}
Lease number {$LeaseNumber}

Occupants:
<!-- loop over Occupants in your template -->
{$Occupants.Name}, age {$Occupants.Age}

Step 4: Test the Document

Under Creating the document:

  • Test mode creates the documents in the test mode of Formstack Documents. Use it while you build the template and switch it off when you go live. The feed list shows each feed as Live or Test mode.
  • Create a test document now uses the saved feed with the latest entry of the form (or sample values when there is none), always in test mode. The result, such as “Test document created: Lease agreement – Ana Ruiz.pdf (72 KB) in 0.8 s from entry #89”, appears next to the button. Nothing is saved on the entry.
  • Background (on by default): the visitor sees the confirmation at once and the document is made right after, through the Gravity Forms background queue. When you attach the file to a notification that is sent on form submission, the add-on makes that document during the submission instead, so the e-mail can carry it.
  • Wait for the document: 30, 60 or 120 seconds. Large data routes may need the longer time.

Step 5: The Finished Document

The Finished document section of a Formstack Documents feed: Keep a copy on this site in a protected uploads folder, who can open the link (anyone with the link or only logged-in users who can view entries), the notifications to attach the file to (Applicant confirmation, Leasing office: lease ready, Leasing office: lease failed) and conditional logic
Keep the file, choose who can open its link and attach it to notifications.
  • Keep a copy (on by default) saves the file in a protected folder of your uploads (wp-content/uploads/gravityextra-documents). The folder blocks direct access, and files are opened through a signed link that only works for that file.
  • Who can open the link: anyone who has the link (good for confirmation pages and e-mails to the person who filled in the form), or only logged-in users who can view entries.
  • Attach to notifications: tick the notifications that should carry the file.
  • Conditional logic: create the document only when the entry matches, for example a pet addendum only when Pets is Yes.

With Keep a copy and attachments off, the add-on only sends the data: Formstack Documents creates the document and sends it through the deliveries of the document, and the entry note says so. When the service answers with a temporary download link, the add-on downloads the file and keeps it; with Keep a copy off it stores the temporary link instead (these links expire after a while).

The Entry Screen

A Lease application entry in Gravity Forms with the Formstack Documents box on the right: the feed Lease agreement created the file Lease agreement - Marco Bianchi.pdf of 72 KB and the data route Tenant pack created two files, the lease agreement and a pet addendum, each with a Generate again button, and entry notes that list the files that were created and kept on the site
The entry screen: every document with its link and size, Generate again, and a note for each document.

Each entry gets a note for every document, with the file name, size, time and test mode. The Formstack Documents box on the entry screen lists each feed with its status (Created, Sent by Formstack Documents, Failed or Not created), the files with links, and a Generate again button for users who can edit entries. Use it after you change a template or fix an entry. The latest document link is also saved as the entry property Document link (Formstack Documents), which you can show as a column in the entry list and include in exports.

Merge tag Shows
{formstack_document_url} The link to the latest document of the entry.
{formstack_document_url:12} The link to the document of feed 12 (the feed ID is in the feed list URL).
{formstack_document_name} The file name, for example Lease agreement – Ana Ruiz.pdf. Also with a feed ID.
{formstack_document_error} What went wrong, in the “document failed” event.

Put {formstack_document_url} in a text confirmation (“Download your lease agreement”) when the feed runs during the submission, or in a notification. The add-on also adds two notification events to forms with a feed: Formstack Documents: document ready, sent as soon as the file exists (also when it was made in the background), and Formstack Documents: document failed, for example to tell your office about a problem.

On forms with a payment add-on, such as Stripe or PayPal, open the payment feed and tick Create the Formstack Documents document only when the payment is received under Post Payment Actions. The document is then created when the payment is completed, not when the form is submitted, so nobody gets a contract or a ticket for a payment that failed.

Errors

Every problem is written as a clear entry note, logged in the Gravity Forms logs, and marks the feed as failed for that entry:

What happened Note on the entry
Wrong API key, secret or merge key Formstack Documents answered HTTP 401 (the API key, the secret or the merge key was refused).
Document deleted in Formstack Documents The chosen document or data route is not in the Formstack Documents account any more.
Data refused Formstack Documents answered HTTP 422 (the data was refused), with the reason of the service.
Too many requests HTTP 429 (too many requests, try again in a minute).
Service problem or time-out HTTP 5xx (a problem on the service side) or No answer from Formstack Documents.

After a fix, use Generate again on the entry. Secrets and merge keys are masked in every note and log line.

For Developers

  • gefd_merge_data changes the data sent to Formstack Documents (arguments: data, entry, form, feed settings).
  • gefd_file_access decides who may open a document link.
  • gefd_api_base changes the API host (https only), and gefd_max_file_size the largest file kept (25 MB by default).
add_filter( 'gefd_merge_data', function ( $data, $entry, $form, $feed ) {
    $data['SignedOn'] = wp_date( 'F j, Y' );
    return $data;
}, 10, 4 );

Troubleshooting

The document list is empty.

Check the API key and secret with Test the connection, then click Refresh the list in the feed. New documents in Formstack Documents show up after a refresh.

A merge field stays empty in the document.

Merge field names must match the template exactly, including capitals. Compare the list “Fields in this template” with your map, and check that the form field has a value in the entry.

With Background on, the document is made right after the confirmation. Use the “document ready” notification for the link, or switch Background off for that feed.

What happens to the files when I delete an entry?

The stored files of the entry are deleted with it. Uninstalling the add-on removes its settings and feeds but keeps the files of existing entries.

What happens without an active licence?

You cannot add new feeds. Existing feeds keep creating documents, so your forms are never interrupted.

Create Documents From Gravity Forms

Fill your Formstack Documents templates with every entry and get the finished file back on the entry, in e-mails and on the confirmation page.

Still need help?

Our support team answers tickets every day, usually within a few hours.

0
0
Your Cart
Your cart is emptyReturn to Shop
🔥 FREQUENTLY BOUGHT TOGETHER
Complete Combo & Save 40%!
ITEM IN YOUR CART
Gravity Forms Klaviyo Add-on
$39.00/yr
+
🎁 RECOMMENDED ADD-ON SAVE 40% OFF
Original Price: $39.00/yr
Bundle Special Price: $23.40/yr