DocuSign API 嵌入式签名集成

DocuSign API Embedded Signing Integration

我正在处理需要新用户签署文档的注册流程。我为此使用 DocuSign 嵌入签名工作流程

我在 docusign 管理面板中创建了带有 pdf 文档的模板并添加了 1 个测试路径:

并且在后端我正在执行以下 api 调用:

  1. 第 1 步 - 登录 API 调用(用于检索您的 baseUrl)- restapi/v2/login_information
  2. 第 2 步 - 从模板创建信封并发送 - baseURL + "/envelopes"
  3. 第 3 步 - 启动嵌入式签名视图(又名收件人视图)- baseURL + uri + "/views/recipient"

作为电子邮件的参数,用户名如果​​我发送 test@mail.com,test2(就像在路由中一样)然后 当我转到检索到的收件人视图 url 时,我看到该表单已经有 Sign 和 Initials 的占位符,因为我在管理面板中为 test2 用户添加了这些标签,并且表单如下所示:

太棒了!

但如果我将 test3 和 test3@mail.com 作为用户名和电子邮件参数发送,在这种情况下我会看到这样的表格:

用户可以在此处放置他的标志和其他元素([​​=37=]这是错误的)

我需要所有将要注册的新用户的用户名和电子邮件的行为(就像所有用户都会看到这些标记和初始标记一样)我无法将它们添加到管理面板中进行路由,因为我不知道将访问网站的新用户的电子邮件。

有没有办法做到这一点?

@AndrewWilson 请求的 STEP2 请求正文

"<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 是动态的,doc 的templateId 常量

这是一个示例调用,它将在角色名称为 Awesome Role 的模板上填写您的收件人信息,而 email姓名均为空白

{
    "emailSubject": "Super Awesome DocuSign Integration",
    "templateId": "{templateId}",
    "status": "sent",
    "templateRoles": [
        {
            "email": "person@email.com",
            "name": "First Last",
            "roleName": "Awesome Role",
            "clientUserId": 123456
        }
    ]
}

如果你想开始动态添加额外的标签,你会想开始使用 compositeTemplates,这些会增加调用的难度,但这里是一个使用相同的模板,但为收件人添加了签名标签。

{
    "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"
                                        }
                                    ]
                                }
                            }
                        ]
                    }
                }
            ]
        }
    ]
}

DocuSign REST API Guide

中有关复合模板的更多信息