0

I am embedding the signing of a set of documents in a web application. Ultimately, the documents will be filled in with answers provided during an online interview. Three or four documents are needed in the envelope. The documents are server-based templates. In the template definitions I have left the name and email fields blank for the Applicant role (signer), as they are generic templates that will be used by many applicants.

In a test scenario, I can load a single template in an envelope and carry it through the process, but when I convert to a composite template, I get the error "errorCode": "RECIPIENTS_NOT_PROVIDED", "message": "No recipients were found in the request." from the envelope request. I have compared the code to many examples and haven't been able to see anything different. There has to be something basic that I'm missing--not surprising, as this is my first attempt with the DocuSign API. Can someone please enlighten me?

The failing code:

{
    "accountId":"xxxxxxx",
    "emailSubject":"WOTC Certification Documents - Test Dummy",
    "emailBlurb":"Documentation to be submitted by Consultant",
    "status":"sent",
    "compositTemplates":{
        "serverTemplates":[{
            "sequence":"1",
            "templateId":"ca18aba4-49bd-4c28-9dce-fbd2dd3fbb7b",
            "recipients":{
                "signers":{
                    "name":"Test Dummy",
                    "roleName":"Applicant",
                    "recipientId":"1",
                    "clientUserId":"Dummy1234",
                    "email":"dummy@mydomain.com"
                }
            }
        },{
            "sequence":"2",
            "templateId":"5ed3d600-5a57-4fee-931f-53233858dc65",
            "recipients":{
                "signers":{
                    "name":"Test Dummy",
                    "roleName":"Applicant",
                    "clientUserId":"Dummy1234",
                    "email":"dummy@mydomain.com"
                }
            }
        }]
    }
}

Thank you.

Larry K
  • 47,808
  • 15
  • 87
  • 140
servant
  • 15
  • 4

1 Answers1

2

You're on the right track, but I'd suggest you make the following changes to the JSON that you've posted:

  • "compositTemplates" is missing an "e" -- should be compositeTemplates
  • compositeTemplates needs to be an Array of objects
  • each object within the compositeTemplates Array needs to contain a serverTemplates property (an Array that specifies the template info) and an inlineTemplates property (an Array that specifies the recipient info)
  • within each recipients object, signers needs to be an Array of objects
  • each signer object needs a recipientId property

Here's your JSON again, modified to implement the changes I've listed above:

{
    "accountId":"xxxxxxx",
    "emailSubject":"WOTC Certification Documents - Test Dummy",
    "emailBlurb":"Documentation to be submitted by Consultant",
    "status":"sent",
    "compositeTemplates":[
    {
        "serverTemplates":[
        {
            "sequence":"1",
            "templateId":"ca18aba4-49bd-4c28-9dce-fbd2dd3fbb7b"
        }],
        "inlineTemplates":[
        {
            "sequence" : 2,
            "recipients":{
                "signers":[{
                    "name":"Test Dummy",
                    "roleName":"Applicant",
                    "recipientId":"1",
                    "clientUserId":"Dummy1234",
                    "email":"dummy@mydomain.com"
                }]
            }
        }],
    },
    {
        "serverTemplates":[
        {
            "sequence" : 3,
            "templateId":"5ed3d600-5a57-4fee-931f-53233858dc65"
        }],
        "inlineTemplates":[
        {
            "sequence" : 4,
            "recipients": {
                "signers" : [{
                    "name":"Test Dummy",
                    "roleName":"Applicant",
                    "recipientId": "1",
                    "clientUserId":"Dummy1234",
                    "email":"dummy@mydomain.com"
                }]
            }
        }]
    }]
}
Kim Brandl
  • 13,125
  • 2
  • 16
  • 21
  • The crazy thing is that I was almost dead on with a previous edition of the code and I started "simplifying" it to try to make it work! In the process, I just hacked up the structure, when (aside from the missing e), all that was originally missing was the array structure for signers. I am puzzled about the sequence numbers, though. In the composite template example on the website, they indicate that the inline template should have the same sequence number as the corresponding server template, but you are serializing them. Can you enlighten me as to the significance of one way vs. the other? – servant Oct 03 '16 at 04:39
  • In pondering this structure, specifically the layers of arrays, I am left with a question: Given that the elements of the compositeTemplate array here are basically serverTemplate/inlineTemplate pairs defining a document, what sort of usage scenario would cause you to use multiple serverTemplates or inlineTemplates within those elements? – servant Oct 03 '16 at 05:03
  • Re sequence numbers -- I've always gotten the desired result by serializing the numbers, so I tend to stick with that approach. Sequence Number is just telling DocuSign what order in which to apply the specified info to the Envelope...so probably wouldn't matter if you instead used the same number for the server template / inline template in this simplistic scenario (i.e., within a composite template object that contains only 1 server template, 1 inline template). – Kim Brandl Oct 03 '16 at 19:49
  • Re your second question (about usage scenario for multiple serverTemplate ojbects or inlineTemplate objects within a single compositeTemplate object) -- I don't believe I've ever personally encountered that scenario. I'm quite certain it was designed that way for a reason, but I've never had to leverage that capability. Unfortunately there's not a lot of documentation about Composite Template usage in the DocuSign API (as I suspect you've already discovered). – Kim Brandl Oct 03 '16 at 19:56