How to send an envelope with extension app data verification fields
This topic demonstrates how to set connected fields in a document and send an envelope with a data verification field. A connected field is a field that can be verified by a connected field or data verification extension in your account.
Connected fields validate data entered in a document against an external system of record before submission. This enables users to verify different data types, such as email addresses, phone numbers, social security numbers, and other supported data verification types. This example will walk you through configuring connected fields using the ConnectedFields:TabGroups endpoint response, constructing an envelope request body containing the information needed to include a connected field, and sending that envelope via email (remote sending).
Prerequisites
- Running this example requires that you have an extension app that includes a connected fields extension or a data verification extension installed in the Developer Console.
- Before running this example, download a connected field or data verification app from the Docusign App Center or build your own using the connected fields reference implementation Connected Fields Reference Implementation or Data Verification Reference Implementation.
- When calling the Connected Fields API, you must include an additional scope,
adm_store_unified_repo_read, in addition to your eSignature scopes.
Run this code example from our Quickstart or launcher projects: Bash, C#, Java, Node.js, PHP, PowerShell, Python, or Ruby.
Required data
Running the code in this how-to requires this data:
Step 1. Obtain your OAuth token
To make the API calls shown in this how-to, you need a valid OAuth access token. Docusign supports access tokens for three different recommended OAuth grant types: Public Authorization Code Grant, Confidential Authorization Code Grant, and JSON Web Token (JWT) Grant. Choose the OAuth grant type appropriate for your scenario.
Wondering which grant type suits your integration? See Authentication for guidance on your options to get an OAuth token.
Step 2. Construct your API headers
After you have a valid OAuth access token, you are ready to construct the API headers that you will pass to the Connected Fields API call. Construct your headers like this, but make sure to substitute your valid OAuth access token for {ACCESS_TOKEN}.
Step 3. Call the Connected Fields API
Make a GET request to the ConnectedFields:TabGroups endpoint to retrieve a list of the extension apps in your account that support data verification, including the definitions of their required verifiable fields, that you will need to create an envelope with connected fields. The GET request will return a JSON response that includes all extension app data in the user’s account. Here’s how you make the call, but make sure to substitute your API account ID for {ACCOUNT_ID}.
Step 4. Extract the tab data from the response
Next, retrieve the required tab information from the response. Begin by creating a filter to identify apps capable of verifying a connected field: data verification extension apps and connected fields extension apps. Then prompt the user to choose an extension app. Finally, extract the tab values from the extensionData object of the selected app for use in Step 5, where they will be used to construct a connected field in the envelope definition. The tab values needed to construct the connected field are:
app_id: The unique ID of the extension app used to verify the field data.extension_group_id: The ID of the group of extensions within the extension app.publisher_name: The publisher of the extension app.application_name: The name of the extension app.action_name: The name of the verification action in the extension app.action_contract: The template defining the verification action.action_input_key: The key representing the input data required for verification. The value for this property determines the actual data type to be verified.extension_name: The name of the extension.extension_contract: The template defining the extension.required_for_extension: A boolean value that indicates whether the field must pass verification before the signer can sign the document.tab_label: The label assigned to the verification field in the document.connection_key: The key used to identify the connection instance.connection_value: The value of the connection instance.
Step 5. Create the envelope definition
Next, create the envelope definition for the request body. If you’re using a Docusign SDK, you can prepare a compatible request body by creating an envelope definition using the included makeEnvelope method.
- Set a
signHeretab to collect signature information. - As an example for this how-to, create a
texttab containing the extension app tab data extracted from Step 4. For your own apps, you may choose any verifiable tabs based on the results of your Connected Fields API call.
Step 6. Create and send the envelope
Now that you have constructed your request body, make a POST request to the eSignature REST API Envelopes:create endpoint and include the request body to create the envelope.
Expected response
If you run this code example from our Quickstart or launcher projects, you should see a JSON response similar to the code shown.
In addition, the signer receives an email containing a signing link that they can use to open and electronically sign the document containing the connected fields using the Docusign mobile app or the Docusign website. After signing is complete, the recipient will receive a carbon copy (CC) of the email that includes all of the completed and signed documents.
Next steps
- Run this code example from our Quickstart or launcher projects: Bash, C#, Java, Node.js, PHP, PowerShell, Python, or Ruby.
- Learn more about Extension apps.
- See how to Go-Live with a completed app and find the base path for API calls in the production environment.