Docusign 客户文档数据

Docusign Customer Document Data

使用 docusign 可以将自定义数据发送到文档。

我们的用例是让客户签署嵌入式表格。我们从我们的数据库中填充他们所有的数据。

因此主合同是相同的,但我们需要将一些值(如合同编号、名称、地址和价格)发送到我们正在签署的文档中。实现此目标的最佳方法是什么?

我已经看到为此目的提到的客户标签,但似乎我们只能在经典视图中执行此操作,这使得新版本似乎不支持此功能。


更新:

在这个问题上我还在犹豫。

我已尝试执行建议的操作并设置 textCustomFields

但是,无论我传入什么,我设置的标签都不显示。

例如

我的文档上有名称字段,还有一个数据标签为:contractid

的文本字段

然后我尝试按照文档中的描述在我的信封中传递数据(我还没有在任何地方找到这样的例子)

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>";

名称字段在合同中正确显示,但这是 Docusign 预定义的自定义字段

但是,contractid 字段只显示空白,因为没有向其中传递任何数据。

我什至尝试将信息添加到对我的视图的调用中,以便在我显示嵌入式合同时使用,但这也没有任何作用。

我可能会以错误的方式解决这个问题,但到目前为止我找不到关于如何通过 REST 将自定义数据发送到合同中的好文档 API。

编辑:

这是我的设置的屏幕截图,我尝试将文本选项卡添加到信封和文档查看请求中。

我不得不说我使用过 Multiple Rest API,包括使用 Twilio、Phaxio、Twitter,而这个 Rest API 实现似乎是我所有 运行 就什么做了什么

这将通过 DocuSign API 完成。您可以基于该合同构建一个模板,并在其中添加需要数据的字段。然后在创建信封时,您可以设置填充在这些字段中的数据。

可以找到更多信息here.

编辑:

可以找到示例代码here

Custom Fields指的是Envelope Custom Fields,它是一个元素,可以用来记录信封的信息,帮助搜索信封和轨道信息,而不是用于制表符。

您需要 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>

我们正在完成我们的 DocuSign 实施,并且能够通过向签名者添加 textTabs 来完成您正在寻找的事情 object。我在 PowerShell 中附加了我的 POC 代码,它显示了正在格式化的选项卡。

我们在 Word 2013 中生成合同并使用锚点放置所有内容。源文档的文本中会有类似 //SIGNATURE// 的内容,但在发布之前它会突出显示并更改为白色字体,因此最终合同在 DocuSign 中呈现得很好。

结果(除了我删掉了名字和标题)

将您的 API 密钥和凭据放入登录功能,并在顶部设置收件人信息。该脚本创建并发送一个包含名为 "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

对于使用 XML 并尝试自动填写数据的用户

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>";

然后在您的文档中的任何地方都有以下文字:您将显示文本,您可以修改它以使用其他字段将其显示在您想要的位置。