0
votes

I'm working on get the signing process on an iFrame to Embedded docusign on my app.

I have trying to work on this based on this tutorials:

Docusign Embedded Signing using template

https://developers.docusign.com/esign-rest-api/guides/features/embedding

Based on what I understood, if you want to embedded you have to create the "create the envelope on the fly". So you don't specify the templateId correct?

So what I don't fully get is, how I get the documentBase64 string value? I have to get it manually? Or docusing api has an endpoint that will return that?

Also I want to know, what happen to the custom fields I added to the template? I can't use them?

Right now this is the json I'm sending:

{{baseUrl}}/envelopes

{

  "emailSubject":"This is a custom email subjet, look at the doc.",

  "status":"sent",

  "templateId":"a0847413-35ac-48ed-9ed6-9b7f96019eda",

  "templateRoles":[
    {

      "email":"[email protected]",

      "name":"Mauricio T",

      "clientUserId": "1234",

      "roleName":"Test",

      "routingOrder":"1",

       "tabs": {

        "textTabs": [

          {

            "tabLabel": "Custom",

            "value": "This is a custom value"

          },
           {
            "tabLabel": "NewCustom",
            "value": "Another custom value added using API"
        },
        {
            "tabLabel": "NewCustom1",
            "value": "Last custom value added using API"
        }

        ]

      }

    }

  ],

  }

And then I go to the recipient view to get the URL:

{{baseUrl}}/envelopes/{{envelopeId}}/views/recipient

{
    "returnUrl": "https://www.google.com.uy",
    "authenticationMethod": "None",
    "email": "[email protected]",
    "userName": "Mauricio T",
    "clientUserId": "1234"
}

As far as I understood this way will not allow the user to sing the document. Need to do it with the document instead.

Can you explain to me how this should work?

Thanks!

UPDATE:

Im manually parsing the bytes of the document to base64. and send this json:

"status":"sent",
"emailSubject":"Envelope with Embedded Signer",
"documents":[
   {
      "documentId":"1",
      "name":"contract.pdf",
      "documentBase64":bytes
   }
],
"recipients":{
   "signers":[
      {
         "email":"[email protected]",
         "name":"Mauricio T",
         "recipientId":"1",
         "clientUserId":"1234"
      }
   ]
}
}

I change the headers, add the accept: application/json and content-type: multipart/from-data

And this is the response I get:

{
    "errorCode": "ENVELOPE_IS_INCOMPLETE",
    "message": "The Envelope is not Complete. A Complete Envelope Requires Documents, Recipients, Tabs, and a Subject Line. Content-Type does not contain boundary parameter."
}
1
Please edit your qs post to add more code - Amit K Bist

1 Answers

1
votes

You can create envelopes in any way, either by using Templates or by passing base64 of document or both as well using Composite Template. When you send templates, then you already have added signers tabs on the document in the templates so you just need to populate the signer details like name and email in creating an envelope and/or pre-populate the DS Tabs value. But when you send document as base64, then you need to tell DocuSign how to add DS Tabs on the document, either by using

  • X and Y position of the tabs
  • AnchorString
  • PDF Field Transformation

Embedded Signing is a type of signing, to implement that you need to just add clientUserId in the signers details. This can be done in both ways either by using template or by passing document as base64 or both as well using Composite Template. Once you have an embedded signer by adding clientUserId then you need to generate signing URL as explained in your qs, by using Recipient View URL, as soon as URL is generated then you will open this URL in IFrame or on new tab.

In the link which you shared is having very small code snippet and it does not have complete example, check Complete Example, and you will see that they are adding DS Tabs on the document using X/Y position.