Docusign Customer Document Data - docusignapi

With docusign is there a way to send custom data to the document.
The use-case we have is that we are having customers sign an embedded form. We populate all of their data from our Database.
So the main contract is the same but we need to send some values such as contract number, name, address, and price to the document we are having signed. What would be the best way to accomplish this?
I have seen customer tags mentioned for this purpose but it seems like we can only do this in classic view which makes it seem like this will not be a supported feature in the new version.
Update:
I am still at a stand still on this issue.
I have tried doing what was suggested and setting textCustomFields
However, no matter what I pass in the label I set up does not show up.
For example.
I have the Name field on my Document and I also have a Text Field with the Data Label of: contractid
Then I try passing the data in in my envelope as described in the documentation (I have yet to find an example of this anywhere)
string requestBody =
"<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">" +
"<status>sent</status>" +
"<emailSubject>DocuSign API - Embedded Signing example</emailSubject>" +
"<templateId>" + templateId + "</templateId>" +
"<templateRoles>" +
"<templateRole>" +
"<email>" + recipientEmail + "</email>" +
"<name>" + recipientName + "</name>" +
"<roleName>" + templateRole + "</roleName>" +
"<clientUserId>1</clientUserId>" + // user-configurable
"</templateRole>" +
"</templateRoles>" +
"<customFields>" +
"<textCustomFields>" +
"<fieldId>contractid</fieldId>" +
"<name>contractid</name>" +
"<required>true</required>" +
"<show>true</show>" +
"<value>123</value>" +
"</textCustomFields>" +
"</customFields>" +
"</envelopeDefinition>";
The name field shows up correctly in the contract, but that is a custom field predefined by Docusign
However, the contractid field just shows blank as no data has been passed into it.
I even tried adding the information into the call to my view for when I show the embeded contract and that does not do anything either.
I may be going about this the wrong way but so far I can find no good documentation on how to send custom data into the contract via the REST API.
Edit:
Here is a Screen Shot of my setup and I have attempted to add the Text Tabs into both the envelope and the document view request.
I have to say I have worked with Multiple Rest API's including working with Twilio, Phaxio, Twitter and this Rest API implementation seems to be the most confusing I have every ran across as far as what does what

We are working through our DocuSign implementation and are able to do what you are looking for with textTabs added to the signers object. I've attached my POC code in PowerShell that shows the tabs being formatted.
We generate contracts in Word 2013 and use anchors to place everything. The source document will have something like //SIGNATURE// in the text, but before release it is highlighted and changed to white font so the final contract renders nicely in DocuSign.
Results in this (except I chopped out the name and title)
Put your API Key and credentials into the logon function and set up the recipient info at the top. The script creates and sends an envelope with document called "contract.docx"
[string]$recipientEmail = "mr.mann#bluesbrothers.com"
[string]$recipientName = "Mr. Mann"
[string]$recipientFirstName = "Mann"
[string]$recipientTitle = "CEO, Mann, Inc."
function boundry {
[System.Guid]::NewGuid().ToString()
}
function encodeFile {
param ([string]$fileName)
[System.Convert]::ToBase64String([IO.File]::ReadAllBytes((Resolve-Path $fileName).ProviderPath))
}
function logonParams {
[string] $userName = 'YOUR USER NAME'
[string] $password = 'YOUR PASSWORD'
[string] $integratorKey = 'YOUR INTEGRATOR KEY'
#"
{
"Username" : "$userName",
"Password" : "$password",
"IntegratorKey" : "$integratorKey"
}
"#
}
function logon {
[string] $loginURL = 'https://demo.docusign.net/restapi/v2/login_information'
$headers =
#{
"X-DocuSign-Authentication"=$(logonParams);
"accept"="application/json";
"content-type"="application/json";
}
$r = Invoke-WebRequest -uri $loginURL -headers $headers -method GET
$responseInfo = $r.content | ConvertFrom-Json
$baseURL = $responseInfo.loginAccounts.baseURL
$baseURL
}
function createEnvelope {
param ([string]$contractFile,
[string]$baseURL
)
[string]$boundry = boundry
$headers =
#{
"X-DocuSign-Authentication"=$(logonParams);
"accept"="application/json";
"content-type"="multipart/form-data; boundary=$boundry";
}
[string]$formData = #"
--$boundry
Content-Type: application/json
{
"status":"sent",
"emailBlurb":"$recipientFirstName, Here is a test contract that I uploaded to DocuSign and routed through their webservice API.",
"emailSubject": "Test Contract $(date)",
"authoritativeCopy" : "true",
"documents": [
{
"name": "$contractFile",
"documentId":"1",
"order":"1"
}
],
"recipients": {
"signers" : [{
"email" : "$recipientEmail",
"name" : "$recipientName",
"title" : "$recipientTitle",
"recipientId":"1",
"tabs" : {
"signHereTabs" : [{
"anchorString" : "//SIGNATURE//"
}],
"fullNameTabs" : [{
"anchorString" : "//SIGNATURE_NAME//",
"font" : "Calibri",
"fontSize" : "Size11",
"anchorYOffset" : -10
}],
"titleTabs" : [{
"anchorString" : "//SIGNATURE_TITLE//",
"font" : "Calibri",
"fontSize" : "Size11",
"anchorYOffset" : -10
}],
"dateTabs" : [{
"anchorString" : "//SIGNATURE_DATE//",
"font" : "Calibri",
"fontSize" : "Size11",
"anchorYOffset" : -10
}],
"textTabs" : [
{
"anchorString" : "//INVOICE_NAME//",
"font" : "Calibri",
"fontSize" : "Size11",
"anchorYOffset" : -10,
"value" : "My Invoice Name",
},
{
"anchorString" : "//INVOICE_ADDRESS1//",
"font" : "Calibri",
"fontSize" : "Size11",
"anchorYOffset" : -10,
"value" : "My Invoice Address 1",
},
{
"anchorString" : "//INVOICE_ADDRESS2//",
"font" : "Calibri",
"fontSize" : "Size11",
"anchorYOffset" : -10,
"value" : "My Invoice Address 2",
},
{
"anchorString" : "//INVOICE_ADDRESS3//",
"font" : "Calibri",
"fontSize" : "Size11",
"anchorYOffset" : -10,
"value" : "My Invoice Address 3",
},
{
"anchorString" : "//INVOICE_EMAIL//",
"font" : "Calibri",
"fontSize" : "Size11",
"anchorYOffset" : -10,
"value" : "somebody#somewhere.com"
}
],
}
}]
}
}
--$boundry
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Content-Transfer-Encoding: base64
Content-Disposition: file; filename="$mainFile";documentid=1
$(encodeFile $contractFile)
--$boundry--
"#
$envelopeURL = "$baseURL/envelopes"
Invoke-WebRequest -uri $envelopeURL -headers $headers -body $formData -method POST
}
$baseURL = logon
createEnvelope "contract.docx" $baseURL

For those using XML and trying to auto fill in the data
string requestBody =
"<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">" +
"<status>sent</status>" +
"<emailSubject>DocuSign API - Embedded Signing example</emailSubject>" +
"<templateId>" + templateId + "</templateId>" +
"<templateRoles>" +
"<templateRole>" +
"<email>" + recipientEmail + "</email>" +
"<name>" + recipientName + "</name>" +
"<roleName>" + templateRole + "</roleName>" +
"<clientUserId>1</clientUserId>" + // user-configurable
"<tabs>" +
"<textTabs>" +
"<text>" +
"<anchorString>follows:</anchorString>" +
"<value>Initial Data Goes</value>" +
"</text>" +
"</textTabs>" +
"</tabs>" +
"</templateRole>" +
"</templateRoles>" +
"</envelopeDefinition>";
Then anywhere in your document you have the words follows: you will have the text show up and you can modify it to display it where you want using other fields.

This would be done through the DocuSign API. You can build a template based on that contract and add the fields that needs data in them. Then when creating the envelope you can set the data that is populated within those fields.
More info can be found here.
EDIT:
Sample code can be found here
Custom Fields refer to Envelope Custom Fields which are an element that can be used to record information about the envelope, help search for envelopes and track information, not for tabs.
You'll want textTab:
<textTabs>
<text>
<anchorIgnoreIfNotPresent>sample string 35</anchorIgnoreIfNotPresent>
<anchorString>sample string 31</anchorString>
<anchorUnits>sample string 34</anchorUnits>
<anchorXOffset>sample string 32</anchorXOffset>
<anchorYOffset>sample string 33</anchorYOffset>
<conditionalParentLabel>sample string 39</conditionalParentLabel>
<conditionalParentValue>sample string 40</conditionalParentValue>
<documentId>sample string 26</documentId>
<pageNumber>sample string 28</pageNumber>
<recipientId>sample string 27</recipientId>
<tabId>sample string 36</tabId>
<templateLocked>sample string 37</templateLocked>
<templateRequired>sample string 38</templateRequired>
<xPosition>sample string 29</xPosition>
<yPosition>sample string 30</yPosition>
<bold>sample string 21</bold>
<font>sample string 20</font>
<fontColor>sample string 24</fontColor>
<fontSize>sample string 25</fontSize>
<italic>sample string 22</italic>
<tabLabel>sample string 19</tabLabel>
<underline>sample string 23</underline>
<concealValueOnDocument>sample string 16</concealValueOnDocument>
<disableAutoSize>sample string 17</disableAutoSize>
<locked>sample string 15</locked>
<maxLength>18</maxLength>
<name>sample string 10</name>
<originalValue>sample string 12</originalValue>
<required>sample string 14</required>
<value>sample string 11</value>
<width>13</width>
<requireAll>sample string 9</requireAll>
<requireInitialOnSharedChange>sample string 7</requireInitialOnSharedChange>
<senderRequired>sample string 8</senderRequired>
<shared>sample string 6</shared>
<validationMessage>sample string 5</validationMessage>
<validationPattern>sample string 4</validationPattern>
<formula>sample string 3</formula>
<height>1</height>
<isPaymentAmount>sample string 2</isPaymentAmount>
</text>
</textTabs>

Related

The identity workflow intput option phone number list specified is empty

I'm trying to create and send an envelope using a DocuSign Template and In Person Signing with SMS Verification. I'm able to send an envelope using regular recipient signers, but having trouble with the Template/In Person Signers combination. I'm getting this response with my request:
{
"errorCode" : "IDENTITY_WORKFLOW_INVALID_INPUTOPTION_EMPTY_PHONE_NUMBER_LIST",
"message" : "The identity workflow intput option phone number list specified is empty."
}
Here's the JSON for my envelope that I'm sending:
{
"disableResponsiveDocument" : false,
"emailBlurb" : "",
"emailSubject" : "Please DocuSign Company Agreement",
"recipients" :
{
"carbonCopies" : []
},
"status" : "sent",
"templateId" : "xxxx-xxx-xxx-xxx-xxxxxxx",
"templateRoles" :
[
{
"hostEmail" : "host#acmetrading.com",
"hostName" : "John Simpson",
"identityVerification" :
{
"inputOptions" :
[
{
"name" : "phone_number_list",
"phoneNumberList" :
[
{
"countryCode" : "61",
"number" : "0412 345 678"
}
],
"valueType" : "PhoneNumberList"
}
],
"steps" : null,
"workflowId" : "xxxx-xxx-xxx-xxx-xxxxxxx"
},
"inPersonSignerName" : "Jenny Jones",
"roleName" : "Customer",
"routingOrder" : "1",
"tabs" : {}
}
]
}
I've followed the instructions for phone authentication and the same code works for regular signers so not sure what I'm doing wrong here?
Phone numbers cannot include spaces
0412 345 678 - is bad
0412345678 is good
(BTW, if this is your real number, you got an SMS from DocuSign - that was me trying it)

Keep getting error "PAYMENTTABS_LINEITEM_AMOUNT_IS_MISSING"

Has anyone tried to change the "fixed amount" of a "payment item" using the DocuSign rest API?
I'm using a template that's been designed and setup via the DocuSign web page.
The template consists of 2 template roles, one of which is the "Customer". It contains a payment item in which I would like to pre-fill the dollar amount, payment description item code, and payment description item details.
I found this in the documentation under 'formulaTabs':
"<paymentDetails>" +
"<lineItems>" +
"<paymentLineItem>" +
"<amountReference>\\*txtPayment</amountReference>" +
"<description>" + polNum + "</description>" +
"<itemCode>" + custId + "</itemCode>" +
"</paymentLineItem>" +
"</lineItems>" +
"</paymentDetails>" +
but, I'm not sure where to place it, I've tried using it within
<envelopeDefinition> </envelopeDefinition>
and
<text> </text>
But, I keep coming up with a PAYMENTTABS_LINEITEM_AMOUNT_IS_MISSING error.
I have a text field on the template labeled txtPayment (which I don't really need).
The payment item is labeled txtPaymentItem.
I'm open to using other means if necessary.
Thanks,
I am hoping that you are able to use Payment using WEBApp but struggling in using API, so the correct JSON structure to use DocuSignPayment API is,
"formulaTabs": [{
"ConcealValueOnDocument": "false",
"Formula": "([PaymentItem1]) * 100",
"IsPaymentAmount": "false",
"Locked": "true",
"Name": "paymentsFormulaTab",
"PaymentDetails": {
"currencyCode": "USD",
"gatewayAccountId": "a7dcd60d-d963-4a81-bc72-68b71aad2062",
"lineItems": [{
"amountReference": "PaymentItem1",
"description": "951900;Tims 6.2;4444;1002",
"itemCode": "base",
"name": "salesDeposit"
}
]
},
"Required": "true",
"RoundDecimalPlaces": "2"
}
],
"numberTabs": [{
"FontColor": "DarkRed",
"IsPaymentAmount": "true",
"Locked": "true",
"TabLabel": "PaymentItem1",
"Value": "2500.00"
}
]
If you see above JSON structure, it has two tabs, formula and Number Tab and formula Tab uses the Number Tab reference. In this case, it refers to PaymentItem1. Hope above JSON will resolve your issue.
Thanks to Amit K Bist this worked to update a payment item tab after it's dropped into a template.
When creating a Template, add your Payment Item, select "Signer Entered" option under Payment Amount and put a value of 0.
Then capture the data label from the Payment Item. It should look similar to this: PaymentCustom 5e7e552c-2d0e-4364-b4d2-bb1784330191
Then add this to your request body:
"<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">" +
"<status>sent</status>" +
"<emailSubject>Turner Pest Control - Termite Bond Quote</emailSubject>" +
"<templateId>" + templateId + "</templateId>" +
"<templateRoles>" +
"<templateRole>" +
"<name>" + custName + "</name>" +
"<email>" + custEmail + "</email>" +
"<roleName>Customer</roleName>" +
"<tabs>" +
"<numberTabs>" +
"<number>" +
"<fontColor>DarkRed</fontColor>" +
"<locked>true</locked>" +
"<tabLabel>PaymentCustom 5e7e552c-2d0e-4364-b4d2-bb1784330191</tabLabel>" +
"<value>" + txtPayment + "</value>" +
"</number>" +
"</numberTabs>" +
"</tabs>" +
"</templateRole>" +
"</templateRoles>" +
"</envelopeDefinition>";
How a Payment Item gets turned into a number tab is beyond me, but, it works!
I'm still working on updating the payment details via API. Getting a Card declined error so I can't confirm if the payment details are getting updated.

Docusign Anchor tab

I am trying to send a document for signing via the DocuSign REST API. I'm using Sign Here tabs with an Anchor text string.
The JSON Object request:
"emailSubject" : "This is email subject",
"emailBlurb" : "This is email body",
"recipients" : {
"signers" : [ {
"routingOrder" : "1",
"name" : "Recipeient Name",
"email" : "Recipeient Email Address",
"recipientId" : "1",
"tabs" : {
"signHereTabs" : [ {
"anchorString" : "By:",
"anchorXOffset" : "1",
"anchorYOffset" : "1",
"anchorIgnoreIfNotPresent" : "true",
"anchorUnits" : "inches"
} ]
}
} ]
},
"documents" : [ {
"name" : "document.pdf",
"documentId" : "1",
"bytes" : "Byte Representaton of document"
} ],
"status" : "sent"
}
This is working perfectly fine with a minor glitch: The document has two matching strings "By:", and the Sign Here tab is placed on both of them.
Is there a way I can restrict this to only add the Sign Here tab to the first instance of the string "By:" in the document?
Unfortunately, no. The anchor strings on your document must be unique, otherwise that tag will be placed anywhere that string is found. See the Rules for working with anchors section here.

Docusign : How can I ensure that user has to enter name for signing?

I have the Embedded Signing API. The document shows up fine and the user is allowed to sign and finish. All that is working fine.
Now the business users have a requirement where they want to ensure that the user has to enter their name. Is that possible ?
I tried not sending in the '' attribute in the xml or sending in a blank value for
'<name>'
But they all come back with an error.
I have to send in a value for
'<name>'
in the request and that is the name that is shown up automatically in the signature field to be selected. Is it possible to ensure that the user has to enter name in the field and then accept that as a signature ?
Thanks
Update
I am using C# and I have this xml :
"<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">" +
"<status>sent</status>" +
"<emailSubject>DocuSign API - Embedded Signing example</emailSubject>" +
"<templateId>" + templateId + "</templateId>" +
"<templateRoles>" +
"<templateRole>" +
"<email>" + recipientEmail + "</email>" +
"<name>" + recipientName + "</name>" +
"<roleName>" + templateRole + "</roleName>" +
"<clientUserId>" + clientUserId + "</clientUserId>" +
"<tabs>" +
"<textTabs>" +
"<anchorString>Full Name</anchorString>" +
"<tabLabel>Full Name</tabLabel>" +
"<documentId>1</documentId>" +
"<pageNumber>1</pageNumber>" +
"<recipientId>1</recipientId>" +
"<xPosition>24</xPosition>" +
"<yPosition>153</yPosition>" +
"<value>" + "Enter Name here" +"<value>" +
"<required>true</required>" +
"</textTabs>" +
"</tabs>" +
"</templateRole>" +
"</templateRoles>" +
"</envelopeDefinition>";
And I get this error:
<errorCode>INVALID_REQUEST_BODY</errorCode>
<message>The request body is missing or improperly formatted. The XML request does not match the expected format. </message>
What exactly is your business use-case that requires users to type in their name? Are you trying to create some extra form of acknowledgement or agreement by having them write in their full name into a text field? If so why not just put a radio button into your envelopes which says something like "I agree to blah blah blah..." and let them choose Yes or No and go from there? You could even have a conditional field then pop up if they select the Yes button and have them fill in the field then, etc.
With all that said, if still want to set a required, editable data field for signers to type their name into you can do this through the API, you just need to fix the issues I listed in my above comment. Here's sample XML and JSON that you could use:
<textTabs>
<text>
<tabLabel>Full Name</tabLabel>
<locked>true</locked>
<required>true</required>
<documentId>1</documentId>
<pageNumber>1</pageNumber>
<recipientId>1</recipientId>
<xPosition>24</xPosition>
<yPosition>153</yPosition>
<value>Enter Name here</value>
</text>
</textTabs>
And here's the JSON version:
"textTabs": [
{
"tabLabel": "Full Name",
"locked": "false",
"required": "true",
"pageNumber": "1",
"documentId": "1",
"xPosition": "200",
"yPosition": "200",
"value": "Enter Name here"
},

DocuSign API Embedded Signing Integration

I working on signup process that require new user to sign on documents. I am using DocuSign embed signing workflow for that
I have created template with pdf document in docusign admin panel and added 1 test route:
and in the backend I am performing following api calls:
STEP 1 - Login API Call (used to retrieve your baseUrl) - restapi/v2/login_information
STEP 2 - Create an Envelope from Template and Send - baseURL + "/envelopes"
STEP 3 - Launch the Embedded Signing view (aka recipient view) - baseURL + uri + "/views/recipient"
and as parameters for email, username if I am sending test#mail.com, test2 (like in route) then
when I go to the retrieved recipient view url I see that form already has the placeholder for Sign and Initials since I have added these tags for test2 user in admin panel and form looks like:
Which is GREAT!
But not if I will send test3 and test3#mail.com as username and email params in this case I see form like this:
Here user can place his sign and other elements where he wants(which is BAD)
I need that behavior for all usernames and emails of new users that will signup(like all user will see these tags to sign and initial) I can't add them into admin panel to route since I don't know emails of new users that will came to site.
Is there a way to accomplish that ?
RequestBody for STEP2 for #AndrewWilson's request
"<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">" +
"<status>sent</status>" +
"<emailSubject>DocuSign API - Embedded Signing example</emailSubject>" +
"<templateId>" + TEMPLATE_ID + "</templateId>" +
"<templateRoles>" +
"<templateRole>" +
"<email>" + recipientEmail + "</email>" +
"<name>" + recipientName + "</name>" +
"<roleName>test2</roleName>" +
"<clientUserId>1</clientUserId>"
"</templateRole>" +
"</templateRoles>" +
"</envelopeDefinition>";
recipientEmail, recipientName it will be dynamic, templateId constant for doc
Here is a sample call that would fill out your recipient information on a template that has roleName of Awesome Role, while email and name are both blank
{
"emailSubject": "Super Awesome DocuSign Integration",
"templateId": "{templateId}",
"status": "sent",
"templateRoles": [
{
"email": "person#email.com",
"name": "First Last",
"roleName": "Awesome Role",
"clientUserId": 123456
}
]
}
If you want to start adding additional tags dynamically, you'd want to start using compositeTemplates, these increase the difficulty of the call, but here is a sample call using the same template but adding a Signature tag for the recipient.
{
"emailSubject": "Super Awesome DocuSign Integration",
"status": "sent",
"templateId": "{templateId}",
"templateRoles": [
{
"email": "person#email.com",
"name": "First Last",
"roleName": "Awesome Role",
"clientUserId":123456
}
],
"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"email": "person#email.com",
"name": "First Last",
"clientUserId":123456,
"recipientId": "1",
"defaultRecipient": "true",
"tabs": {
"signHereTabs": [
{
"xPosition": "200",
"yPosition": "200",
"documentId": "1",
"pageNumber": "1"
}
]
}
}
]
}
}
]
}
]
}
More on Composite Templates in the DocuSign REST API Guide

Resources