0
votes

Using the DocuSign REST Api page at http://iodocs.docusign.com/ I have created a Composite envelope under the "Request Signature" tab using the "From Composite Templatesv2/accounts/:accountId/envelopes" option. My request url is: "uri": "//demo.docusign.net/restapi/v2/accounts/660598/envelopes" and the body is

 {
  "emailBlurb": "Sign Me",
  "emailSubject": "Sign this",
  "status": "Created",
  "templateId": "d34e9aa1-bc1d-41bc-ab3d-de42057dc990",
  "templateRoles": [
    {
      "tabs": {
        "textTabs": [
          {
            "tabLabel": "AccountFirstName",
            "value": "FirstName"
          },
          {
            "tabLabel": "AccountLastName",
            "value": "LastName"
          }
        ]
      },
      "roleName": "Account Holder",
      "name": "William Heine",
      "email": "[email protected]"
    }
  ],
  "compositeTemplates": [
    {
      "serverTemplates": [
        {
          "sequence": "1",
          "templateId": "d34e9aa1-bc1d-41bc-ab3d-de42057dc990"
        }
      ],
      "inlineTemplates": [
        {
          "sequence": "1"
        }
      ]
    },
    {
      "serverTemplates": [
        {
          "sequence": "2",
          "templateId": "2661f101-6bea-4ec1-826d-d3f69863c393"
        }
      ],
      "inlineTemplates": [
        {
          "sequence": "2"
        }
      ]
    },
    {
      "serverTemplates": [
        {
          "sequence": "3",
          "templateId": "1e2aa3b8-8e17-4b57-b7b1-5539a896f1c0"
        }
      ],
      "inlineTemplates": [
        {
          "sequence": "3"
        }
      ]
    },
    {
      "serverTemplates": [
        {
          "sequence": "4",
          "templateId": "5a59fdd0-ae1d-4907-aead-608fc544422f"
        }
      ],
      "inlineTemplates": [
        {
          "sequence": "4"
        }
      ]
    }
  ]
}

The response to this is:

{
  "envelopeId": "3a9388dc-5c8e-49f5-88c5-7e666363534a",
  "uri": "/envelopes/3a9388dc-5c8e-49f5-88c5-7e666363534a",
  "statusDateTime": "2014-07-25T22:50:45.9000000Z",
  "status": "created"
}

Next I got to the "Views" tab and make the call "Recipientv2/accounts/:accountId/envelopes/:envelopeId/views/recipient" with this url: "uri": "//demo.docusign.net/restapi/v2/accounts/660598/envelopes/3a9388dc-5c8e-49f5-88c5-7e666363534a/views/recipient" and this body:

{
  "authenticationMethod": "email",
  "email": "[email protected]",
  "returnUrl": "http://testing.ad.mtrust.com/",
  "userName": "William Heine"
}

and I get this error:

{
  "errorCode": "UNKNOWN_ENVELOPE_RECIPIENT",
  "message": "The recipient you have identified is not a valid recipient of the specified envelope. Envelope recipient could not be determined. 'clientUserId', 'email', or 'userName' in request and envelope may not match."
}

The user name and email are the same. There is no place to enter the clientUserId on the composite envelope. So why is this not working?

2

2 Answers

1
votes

When you send the envelope with status created, it will become a draft in DocuSign. You will have to send with the status, sent, to send and make it available to recipients.

The views/recipients request requires the envelope to be in any status except for created.

1
votes

In order to use embedded signing (and the Recipient View) the recipient must have a clientUserId. Although iodocs may not expose it, this is a requirement unless your signer is also the authenticated API user. You can add "clientUserId" to the signer objects in inlineTemplates:

{
    "emailSubject": "Embedded composite",
    "emailBlurb": ".",
    "status": "sent",
    "compositeTemplates": [{
    "inlineTemplates": [{
        "sequence": "1",
        "recipients": {
        "signers": [{
            "email": "[email protected]",
            "name": "Signer Sam",
            "recipientId": "1",
            "roleName": "Signer",
            "DefaultRecipient": "true",
            "clientUserId": "12345"
        }]
        }
    }],
    "document": {
        "documentId": "1",
        "name": "test doc.pdf",
        "TransformPdfFields": "true"
    },
    }]
}