-->

DocuSign API Embedded Signing Integration

2019-04-16 18:51发布

问题:

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:

  1. STEP 1 - Login API Call (used to retrieve your baseUrl) - restapi/v2/login_information
  2. STEP 2 - Create an Envelope from Template and Send - baseURL + "/envelopes"
  3. 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

回答1:

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



标签: docusignapi