Developerh
Developerh

Reputation: 1

Docusign is sending document twice within email?

i'm currently testing the docusign signature API and i'm having issues with creating an envelope from template. The email sends my document twice, repeated and i can't seem to fix it without screwing something else up.

{
  "status":"sent",
  "emailBlurb":"envelope_body",
  "emailSubject":"envelope_subject",
  "compositeTemplates":[
    {
      "compositeTemplateId":"1",
      "serverTemplates":[
        {
          "sequence":"1",
          "templateId":"insert template id"
        }
      ],
      "inlineTemplates":[
        {
          "sequence":"2",
          "recipients":{
            "signers":[
                {
                    "clientUserId":"1234",
                    "email":"myemail",
                    "name":"applicant",
                    "recipientId":"1",
                    "roleName":"Applicant"
                }
                
            ]
          }
        }
      ]
    },
    {
        "compositeTemplateId":"1",
        "inlineTemplates":[
        {
          "sequence":"3",
          "documents":[
            {
              "documentBase64": " - insert base64 here",
              "documentId":"10",
              "fileExtension":"PDF",
              "name":"addendum",
            }
          ]
        }
      ]
    }
  ]
}      

Upvotes: 0

Views: 374

Answers (1)

Jeff Kyllo
Jeff Kyllo

Reputation: 698

The request that you have above is using a server-side template (which contains a document) but you are also specifying a document in the request (the base64-encoded content). The result will be two documents in your envelope.

You should remove the second composite template block if you do not want that document to be included. E.g.

{
  "status":"sent",
  "emailBlurb":"envelope_body",
  "emailSubject":"envelope_subject",
  "compositeTemplates":[
    {
      "compositeTemplateId":"1",
      "serverTemplates":[
        {
          "sequence":"1",
          "templateId":"insert template id"
        }
      ],
      "inlineTemplates":[
        {
          "sequence":"2",
          "recipients":{
            "signers":[
              {
                "clientUserId":"1234",
                "email":"myemail",
                "name":"applicant",
                "recipientId":"1",
                "roleName":"Applicant"
              }
            ]
          }
        }
      ]
    }
  ]
} 

If you instead want to apply your server-side template to the document in your request, then these must be part of the same compositeTemplate block. E.g. something like this:

{
  "status":"sent",
  "emailBlurb":"envelope_body",
  "emailSubject":"envelope_subject",
  "compositeTemplates":[
    {
      "compositeTemplateId":"1",
      "serverTemplates":[
        {
          "sequence":"1",
          "templateId":"insert template id"
        }
      ],
      "inlineTemplates":[
        {
          "sequence":"2",
          "recipients":{
            "signers":[
              {
                "clientUserId":"1234",
                "email":"myemail",
                "name":"applicant",
                "recipientId":"1",
                "roleName":"Applicant"
              }
            ]
          }
        }
      ],
      "document": {
        "documentBase64": " - insert base64 here",
        "documentId":"10",
        "fileExtension":"PDF",
        "name":"addendum",
      }
    }
  ]
}

Upvotes: 1

Related Questions