Signature Appliance Web Agent API PHP: Integrating WebMerge, JotForm, and GravityForms
This example demonstrates how to integrate an online forms SAAS service to create a PDF document via WebMerge, and then sign it using the DocuSign Signature Appliance Web Agent. The example supports both JotForm and GravityForms. The software is designed to enable support for additional form SAAS services such as Wufoo, Form Assembly, etc.
WebMerge and SAAS Form services are often used in background mode: after filling in a SAAS form, the user is directed to a “thank you” page, and the form data is processed in the background.
In this example software, the processing is done in the foreground: after completing the form, the user is directed to an intermediate page (the interstitial page), then re-directed to the authentication or signing ceremony from the Web Agent.
Expanding the Example
The plugin can be expanded to do more with the signed file: mailing it, storing it in SharePoint or another ECM, on a network drive, etc. The plugin could also support more Form SAAS services and could support Signature Tag Locators. WordPress Plugin
The example was written as a WordPress plugin, “WP CoSign Forms Support.” WordPress provides an open-source, easy to install framework for php applications, including database support. While WordPress was designed as a blogging platform, its use as an application platform is accelerating.
The plugin requires and uses two other plugins, JSON REST API, and WordPress Logging Service. WP CoSign Forms Support has been tested with WordPress 4.1 on Linux and Windows.
Create a WebMerge account and either a JotForm account or install GravityForms. You can use the free version of JotForm to try the integration.
Install WordPress and the two required plugins noted above. Activate the plugins. Then install the example plugin: download it from this site, and then upload the zip file to your WordPress site.
To upload to WordPress, in the Dashboard, click on Plugins / Add New. You will see the “Install Plugins” page. Then use the “Upload” link at the top of the page to upload the plugin.
After uploading, activate the plugin.
Use the WordPress Dashboard Settings / WP CoSign Forms Support to see the plugin’s setting screen. Most configuration is done in your form’s system by adding specific hidden fields to the form.
The form’s hidden fields are used by the plugin to set the WebMerge template, to specify date fields in the form and how they should be processed, and to optionally set the signer’s DocuSign Appliance username and password. If the signer’s information is not set in the form, then Web Agent will use its authentication screen to gather the data.
Files and Architecture
The plugin includes the following key files and directories:
This is the mainline of the plugin. It initiates the SAAS Form and other classes. It provides the HTML for the interstitial between the form and Web Agent. It also includes some utility methods.
This file uses the JSON REST API to create a small REST API used to merge the data with the template via WebMerge and then submit the resulting PDF to CoSign Web Agent. The API also enables the interstitial form to request status on the progress, and retrieves the signed file from CoSign Web Agent.
This class establishes the service point /cfs-gravityforms and handles submissions from GravityForms.
This class establishes the service point /cfs-jotform and handles submissions from JotForm.
This is the unirest-php library. It’s an easy to use API for making http calls out from the software to a web service.
This helper class simplifies sending a file to CoSign Web Agent to be signed, and processing the signed file.