Question

Docusign send envelope from Document (Solved)

  • 17 December 2023
  • 2 replies
  • 281 views

 In response to the post above: 

 

Even if you upload a new document, I recommend you set an empty template with a role for the recipient. Leave the name and email empty for this role since we’ll fill it here in the API request. Just give a name to the role. Once it’s done look at your URL bar and copy the template ID.

 

Now paste this in the requests body:

 

{

  "status": "sent",

  "emailSubject": "{{YOUR SUBJECT}}",

  "emailBlurb": "{{YOUR MESSAGE}}",

  "templateId": "{{TEMPLATE ID}}",

  "documents": [

    {

      "documentId": "1",

      "name": "{{DOCUMENT NAME}}",

      "fileExtension": "pdf",

      "documentBase64": "{{BASE64 STRING}}”

    }

],

"templateRoles": [

  {

    "email": "{{RECIPIENT EMAIL}}",

    "name": "{{RECIPIENT NAME}}",

    "roleName": "{{ROLE NAME AS DEFINED EARLIER}}"

  }

]

}

 


 

Note that you’ll need to encode your document in Base 64 format. In my case I had a PDF URL from a previous Google Docs step in my Zap. You can do that by going to thebase64.com > Signup > Grab your API secret > And add a Base 64 step in your Zap just before Docusign. It’s free and fast.

 

If you want to add a “Sign Here” field in your Docusign document (to make it easier for the recipient), add a comma at the end of the “roleName” line + the following code:

 

"tabs": {

  "signHereTabs": [

    {

      "documentId": "1",

      "pageNumber": "{{THE PAGE NUMBER WHERE YOU WANT THE FIELD}}",

      "xPosition": "100",

      "yPosition": "100"

    }

   ]

  }

 


 

As to “xPosition” and “yPosition”, just make tests and play around to find the right spot.

 

 

 

That’s it! Thanks :)

Adrien


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Hi, thanks for your post. I have the same need to send a dynamic document to docusign. I’m having the following issue with the code above… Any thoughts on how I can fix? Thank you!
 

Failed to create a http request in DocuSign

Raw request failed. Problem executing your request: undefined: INVALID_REQUEST_BODY: The request body is missing or improperly formatted. After parsing a value an unexpected character was encountered: {. Path 'templateRoles', line 27, position 2.

 

 

Hi, thanks for your post. I have the same need to send a dynamic document to docusign. I’m having the following issue with the code above… Any thoughts on how I can fix? Thank you!
 

Failed to create a http request in DocuSign

Raw request failed. Problem executing your request: undefined: INVALID_REQUEST_BODY: The request body is missing or improperly formatted. After parsing a value an unexpected character was encountered: {. Path 'templateRoles', line 27, position 2.

 

 

Thanks for reaching out. It looks like you let an extra “{“ sneak into the request body. Could you supply a screenshot so I can better guide you?